Download html_builder.py from VanyaJ/deck2video-skill: direct link, hf CLI and curl.
- Browser
- Download file 160 kB
-
https://huggingface.co/VanyaJ/deck2video-skill/resolve/main/html_builder.py
- Command line
-
hf download hf://VanyaJ/deck2video-skill/html_builder.py
-
curl -L -o html_builder.py https://huggingface.co/VanyaJ/deck2video-skill/resolve/main/html_builder.py
160 kB
"""
HyperFrames HTML Composition Compiler v3.0 (`html_builder.py`)
Supports:
- 10 Procedural Canvas + Theme Background Presets (`--bg`, incl. `wireframe_globe`, `isometric_hud_grid`, `auto`, `cycle`)
- 3 HUD Styles (`--hud-style`: `chapter_tabs`, `tech_briefing`, `minimal`)
- 6 Subtitle / Caption Styles (`--caption-style`: `glass_dual`, `briefing_clean`, `pill_karaoke`, `cinema_minimal`, `neon_bar_left`, `kinetic_pop`)
- 16 Visual Motion Scene Archetypes (incl. IT톡톡 Deep-Dive Briefings, Text Scramble, Real Video/Image PiP Frames, Vertical Changelog, 3D Mission Staircase, /swarm Network Graph, Pricing Matrix, Bento Grid, 3D Open-Book Flip, Spiral Notebook, etc.)
"""
from __future__ import annotations
import html
import json
import math
import re
import shutil
import subprocess
import urllib.request
from pathlib import Path
from typing import Any
from deck_video_pipeline.themes_and_presets import (
BACKGROUND_PRESETS,
CANVAS_RENDERERS_JS,
auto_select_background,
)
from deck_video_pipeline.pronunciation_engine import balance_subtitle_lines
PIPELINE_ROOT = Path(__file__).resolve().parent
PRETENDARD_URL = "https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/packages/pretendard/dist/web/variable/woff2/PretendardVariable.woff2"
GSAP_URL = "https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"
def _ensure_static_vendor_assets(offline: bool = True) -> tuple[Path, Path]:
font_src = PIPELINE_ROOT / "assets" / "fonts" / "PretendardVariable.woff2"
gsap_src = PIPELINE_ROOT / "assets" / "js" / "gsap.min.js"
font_src.parent.mkdir(parents=True, exist_ok=True)
gsap_src.parent.mkdir(parents=True, exist_ok=True)
if offline:
return font_src, gsap_src
if not font_src.exists() or font_src.stat().st_size < 100_000:
urllib.request.urlretrieve(PRETENDARD_URL, str(font_src))
if not gsap_src.exists() or gsap_src.stat().st_size < 10_000:
urllib.request.urlretrieve(GSAP_URL, str(gsap_src))
return font_src, gsap_src
def _esc(val: Any) -> str:
return html.escape(str(val or ""), quote=True)
def _esc_balanced_sub(val: Any, lang: str = "ko") -> str:
balanced = balance_subtitle_lines(str(val or ""), lang=lang)
return "<br class=\"cap-br\" />".join(_esc(part) for part in balanced.split("\n"))
def _split_card_item(raw: str, idx: int) -> tuple[str, str]:
if "|" in raw:
parts = [x.strip() for x in raw.split("|")]
return parts[0], " · ".join(parts[1:])
if "·" in raw:
left, right = [x.strip() for x in raw.split("·", 1)]
return left, right
words = raw.strip().split()
if len(words) >= 3:
return " ".join(words[:2]), " ".join(words[2:])
return f"포인트 {idx + 1:02d}", raw.strip()
# ---------------------------------------------------------------------------
# 6 New IT톡톡 Tech-Briefing Scene Renderers (v3.0)
# ---------------------------------------------------------------------------
def _render_hero_3d_briefing_scene(slide: dict[str, Any], s_idx: int) -> str:
sid = f"s{s_idx + 1}"
hero_word = slide.get("hero_word") or slide.get("title", "TECH BRIEFING")
sub_line = slide.get("subtitle") or slide.get("highlight_quote") or ""
bullets = slide.get("bullets") or ["화면", "음성", "모델", "/swarm", "워크플로", "요금"]
pill_colors = [
("#34d399", "rgba(6, 78, 59, 0.78)"),
("#a78bfa", "rgba(46, 16, 101, 0.78)"),
("#38bdf8", "rgba(12, 74, 110, 0.78)"),
("#fbbf24", "rgba(120, 53, 15, 0.78)"),
("#fb7185", "rgba(136, 19, 55, 0.78)"),
("#fdba74", "rgba(124, 45, 18, 0.78)"),
("#cbd5e1", "rgba(30, 41, 59, 0.82)"),
]
tags_html = []
for i, b in enumerate(bullets[:7]):
label = b.split("|")[0].strip()[:12]
b_col, bg_col = pill_colors[i % len(pill_colors)]
tags_html.append(
f'<span id="{sid}-htag-{i}" class="hero-topic-pill" style="border-color:{b_col}; background:{bg_col};">{_esc(label)}</span>'
)
src_note = (
f'<div class="hero-meta-note">{_esc(slide["source_note"])}</div>'
if slide.get("source_note")
else ""
)
return f"""
<div id="{sid}-inner" class="scene-inner scene-hero3d">
<div class="hud-corner tl" data-layout-ignore></div>
<div class="hud-corner tr" data-layout-ignore></div>
<div class="hud-corner bl" data-layout-ignore></div>
<div class="hud-corner br" data-layout-ignore></div>
<div id="{sid}-kicker" class="hero3d-kicker">{_esc(slide.get("badge", "DEEP DIVE BRIEFING"))}</div>
<h1 id="{sid}-big-title" class="hero3d-title">{_esc(hero_word)}</h1>
<div id="{sid}-gold-sub" class="hero3d-sub">{_esc(sub_line)}</div>
<div class="hero3d-divider" data-layout-ignore></div>
<div class="hero3d-pills-row">{"".join(tags_html)}</div>
{src_note}
</div>"""
def _render_media_showcase_split_scene(
slide: dict[str, Any],
s_idx: int,
rel_media_path: str,
media_kind: str,
) -> str:
sid = f"s{s_idx + 1}"
bullets = slide.get("bullets") or []
quote_line = slide.get("highlight_quote") or (bullets[0] if bullets else slide.get("title", ""))
hero_kw = slide.get("hero_word") or "LIVE"
scramble_target = slide.get("scramble_text") or slide.get("subtitle") or (bullets[1] if len(bullets) > 1 else slide.get("title", ""))
extra_desc = bullets[2] if len(bullets) > 2 else (bullets[0] if bullets and bullets[0] != quote_line else "")
media_cap = slide.get("media_caption") or slide.get("source_note") or "실시간 시연 화면"
if media_kind == "image" and rel_media_path:
frame_body = f'<img src="{_esc(rel_media_path)}" alt="" class="showcase-media-img" />'
elif media_kind == "video" and rel_media_path:
# Video element itself is mounted as a top-level sibling clip at exact same coordinates
frame_body = '<div class="showcase-video-placeholder" data-layout-ignore></div>'
else:
# Built-in crisp live UI preview card when no external file is attached
sim_rows = "".join(
f'<div class="sim-line"><span class="sim-dot"></span><span>{_esc(b.replace("|", " · "))}</span></div>'
for b in (bullets[:3] or [slide.get("title", "Live Demo")])
)
frame_body = f"""
<div class="showcase-sim-ui">
<div class="sim-top"><span>● New Session</span><span class="sim-rec">● LIVE</span></div>
<div class="sim-body">{sim_rows}</div>
</div>"""
extra_html = f'<div class="split-extra-note">{_esc(extra_desc.replace("|", " · "))}</div>' if extra_desc else ""
frame_extra_cls = " video-host-hidden" if (media_kind == "video" and rel_media_path) else ""
return f"""
<div id="{sid}-inner" class="scene-inner scene-media-split">
<div class="media-left-col">
<div class="top-pill"><span class="pill-dot"></span><span>{_esc(slide.get("badge", "FEATURE SHOWCASE"))}</span></div>
<div class="split-quote">“{_esc(quote_line.replace("|", " · "))}”</div>
<div id="{sid}-hero-kw" class="split-giant-kw">{_esc(hero_kw)}</div>
<div id="{sid}-scramble" class="split-scramble-line" data-target-text="{_esc(scramble_target)}">{_esc(scramble_target)}</div>
{extra_html}
</div>
<div class="media-right-col">
<div id="{sid}-media-frame" class="neon-media-frame{frame_extra_cls}">
{frame_body}
</div>
<div class="media-caption-note">{_esc(media_cap)}</div>
</div>
</div>"""
def _render_dossier_stamp_scene(slide: dict[str, Any], s_idx: int) -> str:
"""Documentary official folder / patent dossier card with tilted rubber stamp (설명좋아하는아저씨 스타일)."""
sid = f"s{s_idx + 1}"
bullets = (slide.get("bullets") or ["핵심 항목 | 세부 내용 요약"])[:4]
title = slide.get("title", "공식 문서 요약")
combined_hdr = (title + " " + slide.get("badge", "") + " " + slide.get("stamp_text", "")).lower()
is_statement = any(k in combined_hdr for k in ["해명", "공식 입장", "statement", "우려", "논란", "없음", "불가", "반박"])
is_patent = (not is_statement) and any(k in combined_hdr for k in ["특허", "patent", "uspto", "등록"])
folder_cls = "dossier-card-white" if is_patent else "dossier-card-kraft"
tab_label = slide.get("badge") if slide.get("badge") and not slide.get("badge", "").startswith("SECTION") else (
"USPTO REGISTERED PATENT" if is_patent else "OFFICIAL STATEMENT · 공식 문서 요약"
)
stamp_txt = slide.get("stamp_text") or ("PATENT REGISTERED" if is_patent else "핵심 쟁점 확인")
stamp_cls = "rubber-stamp stamp-blue" if is_patent else "rubber-stamp stamp-red"
rows_html = []
for i, raw in enumerate(bullets):
k_txt, v_txt = _split_card_item(raw, i)
rows_html.append(f"""
<div id="{sid}-dos-row-{i}" class="dossier-row">
<span class="dossier-key">{_esc(k_txt)}</span>
<span class="dossier-val">{_esc(v_txt)}</span>
</div>""")
meta_right = slide.get("source_note") or slide.get("subtitle") or ""
meta_html = f'<span class="dossier-meta-right">{_esc(meta_right)}</span>' if meta_right else ""
return f"""
<div id="{sid}-inner" class="scene-inner scene-dossier">
<div id="{sid}-dos-shell" class="dossier-shell">
<div class="dossier-folder-tab">{_esc(tab_label)}</div>
<div class="dossier-card {folder_cls}">
<div class="dossier-head-row">
<h2 class="dossier-title">{_esc(title)}</h2>
{meta_html}
</div>
<div class="dossier-divider" data-layout-ignore></div>
<div class="dossier-rows">{"".join(rows_html)}</div>
<div id="{sid}-dos-stamp" class="{stamp_cls}" data-layout-ignore>{_esc(stamp_txt)}</div>
</div>
</div>
</div>"""
def _render_cinema_broll_scene(
slide: dict[str, Any],
s_idx: int,
rel_media_path: str,
media_kind: str,
) -> str:
"""Full-screen documentary B-Roll (image Ken-Burns or sibling video) with dark cinema vignette."""
sid = f"s{s_idx + 1}"
kicker = slide.get("badge") if slide.get("badge") and not slide.get("badge", "").startswith("SECTION") else ""
kicker_html = f'<div class="broll-kicker">{_esc(kicker)}</div>' if kicker else ""
if media_kind == "image" and rel_media_path:
bg_layer = f'<img id="{sid}-broll-img" src="{_esc(rel_media_path)}" alt="" class="broll-full-img" data-layout-allow-overflow data-layout-ignore />'
center_card = ""
elif media_kind == "video" and rel_media_path:
bg_layer = ""
center_card = ""
else:
bg_layer = ""
center_card = f"""
<div class="broll-atmos-title-wrap">
{kicker_html}
<h2 id="{sid}-broll-title" class="broll-atmos-title">{_esc(slide.get("title", ""))}</h2>
</div>"""
return f"""
<div id="{sid}-inner" class="scene-inner scene-broll-full">
{bg_layer}
<div class="broll-vignette" data-layout-ignore></div>
{center_card}
</div>"""
def _render_depth_cross_section_scene(slide: dict[str, Any], s_idx: int) -> str:
"""DeepFactLab-style cross-section depth exploration + descending yellow submersible + evidence quote card."""
sid = f"s{s_idx + 1}"
bullets = slide.get("bullets") or [
"수면 0m | 해발 약 2,189m 칼데라 호수",
"수심 40m | 빛과 카메라가 멈추는 한계선",
"수심 384m | 설악산 대청봉보다 높은 맨 바닥",
]
sticker_main = slide.get("subtitle") or slide.get("title", "수심 단면 탐사")
sticker_sub = (
slide.get("badge")
if slide.get("badge") and not slide.get("badge", "").startswith("SECTION")
else "가상 탐사 · 설명용 단면"
)
quote_raw = slide.get("highlight_quote") or (bullets[-1].replace("|", " — ") if bullets else slide.get("title", ""))
src_foot = slide.get("source_note") or "설명용 단면도 · 공식 기록 요지"
depth_labels = []
y_positions = [132, 232, 336, 428]
for i, b in enumerate(bullets[:4]):
head, desc = _split_card_item(b, i)
yp = y_positions[i]
depth_labels.append(
f'<g id="{sid}-dmark-{i}">'
f'<line x1="250" y1="{yp}" x2="940" y2="{yp}" stroke="#facc15" stroke-opacity="0.34" stroke-width="1.6" stroke-dasharray="7 7" />'
f'<rect x="128" y="{yp - 16}" width="114" height="30" rx="7" fill="#0b1924" stroke="#38bdf8" stroke-width="1.3" />'
f'<text x="185" y="{yp + 5}" text-anchor="middle" fill="#fde047" font-size="14" font-weight="800">{_esc(head[:11])}</text>'
f'<text x="266" y="{yp - 6}" fill="#cbd5e1" font-size="14" font-weight="700">{_esc(desc[:28])}</text>'
f'</g>'
)
return f"""
<div id="{sid}-inner" class="scene-inner scene-depth-cross">
<div class="df-sticker-stack" data-layout-ignore>
<div id="{sid}-df-stick-1" class="df-yellow-sticker">{_esc(sticker_main[:28])}</div>
<div id="{sid}-df-stick-2" class="df-yellow-sticker df-sticker-sm">{_esc(sticker_sub[:24])}</div>
</div>
<div class="df-cross-stage">
<svg viewBox="0 0 1120 490" class="df-cross-svg" data-layout-ignore>
<defs>
<linearGradient id="{sid}-water-grad" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stop-color="#155e75" stop-opacity="0.88" />
<stop offset="52%" stop-color="#0c3547" stop-opacity="0.95" />
<stop offset="100%" stop-color="#041520" stop-opacity="0.99" />
</linearGradient>
<linearGradient id="{sid}-beam-grad" x1="0" y1="0" x2="1" y2="0.6">
<stop offset="0%" stop-color="#fef08a" stop-opacity="0.68" />
<stop offset="100%" stop-color="#fef08a" stop-opacity="0" />
</linearGradient>
</defs>
<!-- Water body inside caldera -->
<polygon points="155,108 965,108 770,446 355,446" fill="url(#{sid}-water-grad)" />
<line x1="150" y1="108" x2="970" y2="108" stroke="#bae6fd" stroke-width="4" />
<!-- Hydrothermal / bottom glow plumes -->
<polygon points="455,446 415,305 510,305 485,446" fill="#fb923c" fill-opacity="0.22" />
<polygon points="655,446 615,315 705,315 685,446" fill="#fb923c" fill-opacity="0.22" />
<!-- Left & Right Rocky Caldera Walls -->
<path d="M 0,18 L 105,18 L 165,108 L 365,446 L 765,446 L 960,108 L 1025,18 L 1120,18 L 1120,490 L 0,490 Z" fill="#2d2620" stroke="#57534e" stroke-width="2.5" />
<!-- Depth strata markers -->
{"".join(depth_labels)}
<!-- Animated Unmanned Yellow Submersible (nested group for safe GSAP y/x translation) -->
<g id="{sid}-sub-mover" transform="translate(635, 118)">
<line x1="0" y1="-130" x2="0" y2="-24" stroke="#94a3b8" stroke-width="2" stroke-dasharray="4 4" />
<polygon points="56,-4 195,42 182,88 52,14" fill="url(#{sid}-beam-grad)" />
<ellipse cx="0" cy="0" rx="58" ry="28" fill="#eab308" stroke="#713f12" stroke-width="2.5" />
<path d="M -56,-8 L -76,-18 L -76,18 L -56,8 Z" fill="#ca8a04" stroke="#713f12" stroke-width="2" />
<circle cx="16" cy="-2" r="10" fill="#38bdf8" stroke="#0f172a" stroke-width="2.5" />
<circle cx="55" cy="-5" r="5" fill="#fef9c3" />
<circle cx="55" cy="8" r="5" fill="#fef9c3" />
</g>
</svg>
<article id="{sid}-df-quote-card" class="df-evidence-card">
<div class="df-ev-tab">📄 탐사 기록 · 팩트 검증</div>
<div class="df-ev-quote">
<span class="df-qmark">“</span>{_esc(quote_raw[:68])}
<span id="{sid}-df-uline" class="df-yellow-underline" data-layout-ignore></span>
</div>
<div class="df-ev-source">— {_esc(src_foot)}</div>
</article>
</div>
</div>"""
def _render_sonar_factcheck_map_scene(
slide: dict[str, Any],
s_idx: int,
rel_media_path: str,
media_kind: str,
) -> str:
"""DeepFactLab-style Multi-Beam Bathymetric Sonar Contour Map OR Photo Zone ①②③ Fact-Check Stage."""
sid = f"s{s_idx + 1}"
bullets = (slide.get("bullets") or ["굳은 마그마 둑 | 화산 분화 흔적", "바닥 웅덩이 | 온천 용출 지점", "무너진 칼데라 벽 | 암석 퇴적 지대"])[:4]
verdict_txt = slide.get("stamp_text") or slide.get("hero_word") or "기록 검증 완료"
is_false_claim = any(k in (verdict_txt + " " + slide.get("title", "")).lower() for k in ["없", "아님", "거짓", "오해", "불가", "괴물", "x", "✕"])
src_foot = slide.get("source_note") or "다중빔 음향 측심 · 현장 조사 기록 재구성"
if media_kind == "image" and rel_media_path:
# Photo + Numbered Dashed Yellow Investigation Polygons (f_370.jpg style)
zone_polys = [
("160,150 310,120 430,275 315,330 190,260", 290, 230, 485, 305),
("365,135 520,185 605,310 510,335 420,245", 485, 250, 665, 325),
("555,105 705,145 735,230 635,245 555,180", 645, 178, 795, 225),
("265,355 595,365 695,435 550,465 280,450", 475, 412, 765, 405),
]
zones_svg = []
for i in range(min(len(bullets), 4)):
pts, cx, cy, ax, ay = zone_polys[i]
zones_svg.append(
f'<g class="{sid}-df-zone">'
f'<polygon class="{sid}-sonar-path" points="{pts}" fill="rgba(250, 204, 21, 0.20)" stroke="#facc15" stroke-width="2.6" stroke-dasharray="9 6" />'
f'<line class="{sid}-sonar-path" x1="{cx + 45}" y1="{cy + 15}" x2="{ax}" y2="{ay}" stroke="#facc15" stroke-width="3" />'
f'<circle cx="{cx}" cy="{cy}" r="18" fill="#facc15" stroke="#0f172a" stroke-width="2.5" />'
f'<text x="{cx}" y="{cy + 6}" text-anchor="middle" fill="#0f172a" font-size="17" font-weight="900">{i + 1}</text>'
f'</g>'
)
legend_rows = "".join(
f'<div id="{sid}-sleg-{i}" class="df-zone-item"><span class="df-zone-num">{i + 1}</span><span>{_esc(b.replace("|", " · "))}</span></div>'
for i, b in enumerate(bullets)
)
visual_left = f"""
<div class="df-photo-map-box">
<img src="{_esc(rel_media_path)}" alt="" class="df-photo-bg" />
<svg viewBox="0 0 920 510" class="df-photo-overlay-svg" data-layout-ignore>{"".join(zones_svg)}</svg>
</div>"""
else:
# Pure SVG Multi-Beam Sonar Contour Map + Callout Pointers + Red X / Check Verdict (f_465.jpg style)
callouts_cfg = [
(118, 175, 365, 228, "#b45309"),
(690, 128, 520, 215, "#1d4ed8"),
(128, 392, 345, 355, "#475569"),
(685, 388, 545, 338, "#0f766e"),
]
callouts_svg = []
for i, b in enumerate(bullets):
head, _ = _split_card_item(b, i)
bx, by, tx, ty, col = callouts_cfg[i % len(callouts_cfg)]
lx = bx + 158 if bx < 400 else bx
callouts_svg.append(
f'<g class="{sid}-df-zone">'
f'<line class="{sid}-sonar-path" x1="{lx}" y1="{by + 20}" x2="{tx}" y2="{ty}" stroke="{col}" stroke-width="2.5" />'
f'<rect x="{bx}" y="{by}" width="158" height="40" rx="20" fill="{col}" fill-opacity="0.88" stroke="#e2e8f0" stroke-width="1.2" />'
f'<text x="{bx + 79}" y="{by + 26}" text-anchor="middle" fill="#ffffff" font-size="16" font-weight="800">{_esc(head[:10])}</text>'
f'</g>'
)
mark_svg = (
f'<g id="{sid}-verdict-mark">'
f'<circle cx="455" cy="272" r="68" fill="none" stroke="#ffffff" stroke-width="2.2" stroke-dasharray="8 7" />'
f'<line x1="406" y1="223" x2="504" y2="321" stroke="#f43f5e" stroke-width="14" stroke-linecap="round" />'
f'<line x1="504" y1="223" x2="406" y2="321" stroke="#f43f5e" stroke-width="14" stroke-linecap="round" />'
f'</g>'
if is_false_claim
else f'<g id="{sid}-verdict-mark">'
f'<circle cx="455" cy="272" r="64" fill="rgba(16, 185, 129, 0.18)" stroke="#34d399" stroke-width="3" stroke-dasharray="8 6" />'
f'<polyline points="420,274 446,300 494,246" fill="none" stroke="#34d399" stroke-width="12" stroke-linecap="round" stroke-linejoin="round" />'
f'</g>'
)
legend_rows = "".join(
f'<div id="{sid}-sleg-{i}" class="df-zone-item"><span class="df-zone-num">{i + 1}</span><span>{_esc(b.replace("|", " · "))}</span></div>'
for i, b in enumerate(bullets)
)
visual_left = f"""
<div class="df-sonar-box">
<svg viewBox="0 0 920 510" class="df-sonar-svg" data-layout-ignore>
<ellipse class="{sid}-sonar-path" cx="455" cy="260" rx="260" ry="215" fill="rgba(132, 204, 22, 0.14)" stroke="#cbd5e1" stroke-width="1.6" stroke-dasharray="7 7" />
<ellipse cx="455" cy="260" rx="220" ry="180" fill="rgba(101, 163, 13, 0.26)" />
<ellipse cx="455" cy="262" rx="182" ry="146" fill="rgba(20, 184, 166, 0.30)" />
<ellipse cx="455" cy="265" rx="142" ry="114" fill="rgba(2, 132, 199, 0.38)" />
<ellipse cx="455" cy="268" rx="98" ry="78" fill="rgba(30, 58, 138, 0.65)" />
<path class="{sid}-sonar-path" d="M 412,248 A 38,34 0 1,1 462,216" fill="none" stroke="#f59e0b" stroke-width="5" stroke-linecap="round" />
<circle cx="436" cy="256" r="14" fill="rgba(125, 211, 252, 0.45)" stroke="#bae6fd" stroke-width="1.5" />
<circle cx="482" cy="254" r="12" fill="rgba(125, 211, 252, 0.45)" stroke="#bae6fd" stroke-width="1.5" />
{"".join(callouts_svg)}
{mark_svg}
</svg>
</div>"""
verdict_cls = "df-verdict-pill verdict-false" if is_false_claim else "df-verdict-pill verdict-true"
return f"""
<div id="{sid}-inner" class="scene-inner scene-sonar-map">
{visual_left}
<div class="df-sonar-right">
<div class="{verdict_cls}">{_esc(verdict_txt)}</div>
<h2 class="df-sonar-title">{_esc(slide.get("title", "음향 측심 및 기록 검증"))}</h2>
<div class="df-zone-list">{legend_rows}</div>
<div class="df-source-pill">{_esc(src_foot)}</div>
</div>
</div>"""
def _make_gear_svg_path(cx: float, cy: float, r_outer: float, r_inner: float, teeth: int) -> str:
pts: list[str] = []
steps = teeth * 4
for i in range(steps):
ang = (2.0 * math.pi * i) / steps
r = r_outer if (i % 4 in (0, 1)) else r_inner
px = cx + r * math.cos(ang)
py = cy + r * math.sin(ang)
cmd = "M" if i == 0 else "L"
pts.append(f"{cmd}{px:.1f},{py:.1f}")
pts.append("Z")
return " ".join(pts)
def _render_archify_architecture_scene(slide: dict[str, Any], s_idx: int) -> str:
"""Multi-tier system architecture SVG diagram + Anime.js live route tracing (Archify style)."""
sid = f"s{s_idx + 1}"
bullets = slide.get("bullets") or [
"Client / Document | 사용자 입력 및 보안 문서",
"Auth / Policy | 접근 제어 및 검증 게이트",
"AI Orchestrator | 멀티 모델 라우팅 허브",
"Compute Engine | 고속 추론 및 모션 합성",
"Output Store | 1080p 결과물 및 아카이브",
]
padded = list(bullets) + [
"Input Layer | 데이터 수집",
"Policy Gate | 보안 검증",
"Core Router | 중앙 오케스트레이터",
"Render Engine | 고속 연산",
"Storage & CDN | 최종 배포",
]
nodes = [_split_card_item(padded[i], i) for i in range(5)]
return f"""
<div id="{sid}-inner" class="scene-inner scene-archify">
<div class="arch-head-bar">
<div class="top-pill"><span class="pill-dot"></span><span>{_esc(slide.get("badge", "SYSTEM ARCHITECTURE"))}</span></div>
<h2 class="arch-main-title">{_esc(slide.get("title", "시스템 아키텍처 구조"))}</h2>
</div>
<div class="arch-svg-card">
<svg id="{sid}-arch-svg" viewBox="0 0 1520 460" class="arch-svg" data-layout-ignore>
<defs>
<linearGradient id="{sid}-arch-grad" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" stop-color="#38bdf8" />
<stop offset="50%" stop-color="#a78bfa" />
<stop offset="100%" stop-color="#34d399" />
</linearGradient>
</defs>
<!-- Tier Zone Backdrops -->
<rect x="28" y="24" width="380" height="412" rx="18" fill="rgba(15,23,42,0.55)" stroke="rgba(56,189,248,0.25)" stroke-dasharray="6 6" />
<text x="52" y="56" fill="#7dd3fc" font-size="14" font-weight="800" letter-spacing="2">TIER 01 · INGEST & EDGE</text>
<rect x="550" y="24" width="420" height="412" rx="18" fill="rgba(30,27,75,0.48)" stroke="rgba(167,139,250,0.32)" stroke-dasharray="6 6" />
<text x="574" y="56" fill="#c4b5fd" font-size="14" font-weight="800" letter-spacing="2">TIER 02 · CORE ORCHESTRATOR</text>
<rect x="1112" y="24" width="380" height="412" rx="18" fill="rgba(6,78,59,0.38)" stroke="rgba(52,211,153,0.28)" stroke-dasharray="6 6" />
<text x="1136" y="56" fill="#6ee7b7" font-size="14" font-weight="800" letter-spacing="2">TIER 03 · ENGINE & DELIVERY</text>
<!-- Anime.js Drawable Connection Routes -->
<path class="{sid}-arch-path" d="M 376 145 C 465 145, 485 235, 584 235" fill="none" stroke="url(#{sid}-arch-grad)" stroke-width="4" stroke-linecap="round" />
<path class="{sid}-arch-path" d="M 376 335 C 465 335, 485 255, 584 255" fill="none" stroke="url(#{sid}-arch-grad)" stroke-width="4" stroke-linecap="round" />
<path class="{sid}-arch-path" d="M 936 235 C 1025 235, 1045 145, 1144 145" fill="none" stroke="url(#{sid}-arch-grad)" stroke-width="4" stroke-linecap="round" />
<path class="{sid}-arch-path" d="M 936 255 C 1025 255, 1045 335, 1144 335" fill="none" stroke="url(#{sid}-arch-grad)" stroke-width="4" stroke-linecap="round" />
<!-- Tier 1 Nodes -->
<g class="{sid}-arch-node">
<rect x="60" y="92" width="316" height="106" rx="16" fill="#0d182e" stroke="#38bdf8" stroke-width="2" />
<text x="86" y="136" fill="#f8fafc" font-size="22" font-weight="800">{_esc(nodes[0][0][:18])}</text>
<text x="86" y="168" fill="#cbd5e1" font-size="15" font-weight="500">{_esc(nodes[0][1][:32])}</text>
</g>
<g class="{sid}-arch-node">
<rect x="60" y="282" width="316" height="106" rx="16" fill="#0d182e" stroke="#38bdf8" stroke-width="2" />
<text x="86" y="326" fill="#f8fafc" font-size="22" font-weight="800">{_esc(nodes[1][0][:18])}</text>
<text x="86" y="358" fill="#cbd5e1" font-size="15" font-weight="500">{_esc(nodes[1][1][:32])}</text>
</g>
<!-- Tier 2 Central Hub -->
<g class="{sid}-arch-node">
<rect x="584" y="166" width="352" height="156" rx="22" fill="#1e1b4b" stroke="#a78bfa" stroke-width="3" />
<text x="760" y="212" text-anchor="middle" fill="#ddd6fe" font-size="14" font-weight="900" letter-spacing="2">CENTRAL HUB</text>
<text x="760" y="254" text-anchor="middle" fill="#ffffff" font-size="26" font-weight="900">{_esc(nodes[2][0][:18])}</text>
<text x="760" y="290" text-anchor="middle" fill="#cbd5e1" font-size="16" font-weight="600">{_esc(nodes[2][1][:32])}</text>
</g>
<!-- Tier 3 Nodes -->
<g class="{sid}-arch-node">
<rect x="1144" y="92" width="316" height="106" rx="16" fill="#062c24" stroke="#34d399" stroke-width="2" />
<text x="1170" y="136" fill="#f8fafc" font-size="22" font-weight="800">{_esc(nodes[3][0][:18])}</text>
<text x="1170" y="168" fill="#cbd5e1" font-size="15" font-weight="500">{_esc(nodes[3][1][:32])}</text>
</g>
<g class="{sid}-arch-node">
<rect x="1144" y="282" width="316" height="106" rx="16" fill="#062c24" stroke="#34d399" stroke-width="2" />
<text x="1170" y="326" fill="#f8fafc" font-size="22" font-weight="800">{_esc(nodes[4][0][:18])}</text>
<text x="1170" y="358" fill="#cbd5e1" font-size="15" font-weight="500">{_esc(nodes[4][1][:32])}</text>
</g>
</svg>
</div>
</div>"""
def _render_anatomy_mechanic_scene(slide: dict[str, Any], s_idx: int) -> str:
"""Isometric mechanical cutaway figure (interlocking gears + pin-tumbler lock + live spec panel — Anatomy style)."""
sid = f"s{s_idx + 1}"
bullets = (slide.get("bullets") or [
"입력 토크 전달 | 드라이브 기어가 핵심 연산 주기를 일정하게 구동",
"다중 핀 정렬 | 조건 핀 3개가 정확한 임계선(Shear Line)에 일치",
"잠금 해제 및 출력 | 모든 검증 통과 시 무손실 파이프라인 개방",
])[:4]
gear_big = _make_gear_svg_path(0, 0, 86, 68, 12)
gear_small = _make_gear_svg_path(0, 0, 58, 44, 8)
spec_cards = []
for i, b in enumerate(bullets):
k_t, v_t = _split_card_item(b, i)
spec_cards.append(f"""
<div id="{sid}-anat-step-{i}" class="anat-spec-row">
<span class="anat-step-idx">0{i + 1}</span>
<div class="anat-step-body">
<div class="anat-step-head">{_esc(k_t)}</div>
<div class="anat-step-desc">{_esc(v_t)}</div>
</div>
</div>""")
return f"""
<div id="{sid}-inner" class="scene-inner scene-anatomy">
<div class="anat-left-fig">
<div class="anat-fig-header">
<span class="anat-fig-tag">FIG {s_idx + 1:02d} · ISOMETRIC CUTAWAY MECHANISM</span>
<span id="{sid}-anat-status" class="anat-fig-live">● ALIGNED 100%</span>
</div>
<svg viewBox="0 0 820 460" class="anat-svg" data-layout-ignore>
<!-- Isometric Blueprint Baseplate -->
<polygon points="410,420 90,290 410,160 730,290" fill="rgba(15,23,42,0.82)" stroke="#38bdf8" stroke-width="2" />
<polygon points="90,290 410,420 410,444 90,314" fill="rgba(8,47,73,0.85)" stroke="#0284c7" stroke-width="1.5" />
<polygon points="730,290 410,420 410,444 730,314" fill="rgba(12,74,110,0.75)" stroke="#38bdf8" stroke-width="1.5" />
<!-- Shear Line Laser Beam -->
<line id="{sid}-anat-beam" x1="395" y1="215" x2="745" y2="215" stroke="#34d399" stroke-width="5" stroke-dasharray="10 6" />
<!-- Interlocking Precision Gears -->
<g transform="translate(215, 225)">
<g id="{sid}-gear-a">
<path d="{gear_big}" fill="rgba(14,165,233,0.28)" stroke="#38bdf8" stroke-width="2.5" />
<circle cx="0" cy="0" r="28" fill="#091326" stroke="#7dd3fc" stroke-width="2.5" />
</g>
</g>
<g transform="translate(348, 178)">
<g id="{sid}-gear-b">
<path d="{gear_small}" fill="rgba(245,158,11,0.28)" stroke="#fbbf24" stroke-width="2.5" />
<circle cx="0" cy="0" r="18" fill="#091326" stroke="#fde68a" stroke-width="2.5" />
</g>
</g>
<!-- 3 Pin-Tumbler Valve Chambers -->
<rect x="448" y="96" width="236" height="218" rx="14" fill="rgba(15,23,42,0.90)" stroke="rgba(148,163,184,0.45)" stroke-width="2" />
<line x1="448" y1="215" x2="684" y2="215" stroke="#38bdf8" stroke-width="2" stroke-dasharray="5 5" />
<g class="{sid}-anat-pin">
<rect x="478" y="128" width="38" height="85" rx="6" fill="#38bdf8" />
<rect x="478" y="219" width="38" height="66" rx="6" fill="#475569" />
</g>
<g class="{sid}-anat-pin">
<rect x="547" y="128" width="38" height="85" rx="6" fill="#a78bfa" />
<rect x="547" y="219" width="38" height="66" rx="6" fill="#475569" />
</g>
<g class="{sid}-anat-pin">
<rect x="616" y="128" width="38" height="85" rx="6" fill="#34d399" />
<rect x="616" y="219" width="38" height="66" rx="6" fill="#475569" />
</g>
</svg>
</div>
<div class="anat-right-col">
<h2 class="anat-title">{_esc(slide.get("title", "핵심 작동 메커니즘"))}</h2>
<div class="anat-spec-list">{"".join(spec_cards)}</div>
</div>
</div>"""
def _render_anime_svg_chart_scene(slide: dict[str, Any], s_idx: int) -> str:
"""Anime.js live pen-drawn SVG spline curve chart + circular KPI ring gauges."""
sid = f"s{s_idx + 1}"
bullets = (slide.get("bullets") or [
"초기 도입 | 기준선 24%",
"자동화 연동 | 처리량 58%",
"모션 고도화 | 몰입도 84%",
"최종 달성 | 생산성 96%",
])[:4]
pts_coords = [(110, 340), (350, 255), (610, 165), (870, 78)]
dots_svg = []
gauges_html = []
ring_colors = ["#38bdf8", "#34d399", "#fbbf24"]
for i, raw in enumerate(bullets):
k_t, v_t = _split_card_item(raw, i)
m_num = re.search(r"(\d+(?:\.\d+)?)", raw)
pct = min(99, max(24, int(float(m_num.group(1))))) if m_num else (42 + i * 18)
cx, cy = pts_coords[min(i, len(pts_coords) - 1)]
dots_svg.append(f"""
<g class="{sid}-chart-dot">
<circle cx="{cx}" cy="{cy}" r="11" fill="#091326" stroke="#38bdf8" stroke-width="4" />
<rect x="{cx - 72}" y="{cy - 52}" width="144" height="34" rx="8" fill="rgba(12,23,46,0.94)" stroke="#38bdf8" stroke-width="1.5" />
<text x="{cx}" y="{cy - 29}" text-anchor="middle" fill="#f8fafc" font-size="15" font-weight="800">{_esc(k_t[:10])}</text>
</g>""")
if i < 3:
dash_total = 226
dash_fill = int(round(dash_total * pct / 100.0))
col = ring_colors[i % len(ring_colors)]
gauges_html.append(f"""
<div id="{sid}-gauge-card-{i}" class="svg-gauge-card">
<svg viewBox="0 0 92 92" class="gauge-ring-svg" data-layout-ignore>
<circle cx="46" cy="46" r="36" fill="none" stroke="rgba(148,163,184,0.2)" stroke-width="8" />
<circle class="{sid}-gauge-arc" cx="46" cy="46" r="36" fill="none" stroke="{col}" stroke-width="8" stroke-linecap="round"
stroke-dasharray="{dash_fill} {dash_total}" transform="rotate(-90 46 46)" />
<text x="46" y="52" text-anchor="middle" fill="#ffffff" font-size="19" font-weight="900">{pct}%</text>
</svg>
<div class="gauge-text-col">
<div class="gauge-label">{_esc(k_t)}</div>
<div class="gauge-sub">{_esc(v_t)}</div>
</div>
</div>""")
return f"""
<div id="{sid}-inner" class="scene-inner scene-anime-chart">
<div class="chart-top-head">
<div class="top-pill"><span class="pill-dot"></span><span>{_esc(slide.get("badge", "LIVE METRIC TRAJECTORY"))}</span></div>
<h2 class="arch-main-title">{_esc(slide.get("title", "핵심 지표 성장 추이"))}</h2>
</div>
<div class="chart-body-row">
<div class="chart-svg-panel">
<svg viewBox="0 0 980 420" class="anime-chart-svg" data-layout-ignore>
<defs>
<linearGradient id="{sid}-area-grad" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stop-color="rgba(56,189,248,0.34)" />
<stop offset="100%" stop-color="rgba(56,189,248,0.0)" />
</linearGradient>
</defs>
<line x1="70" y1="90" x2="920" y2="90" stroke="rgba(148,163,184,0.16)" stroke-dasharray="5 5" />
<line x1="70" y1="180" x2="920" y2="180" stroke="rgba(148,163,184,0.16)" stroke-dasharray="5 5" />
<line x1="70" y1="270" x2="920" y2="270" stroke="rgba(148,163,184,0.16)" stroke-dasharray="5 5" />
<line x1="70" y1="360" x2="920" y2="360" stroke="rgba(148,163,184,0.35)" stroke-width="2" />
<path id="{sid}-chart-area" d="M 110 340 C 230 315, 270 275, 350 255 C 470 225, 510 190, 610 165 C 730 135, 780 95, 870 78 L 870 360 L 110 360 Z" fill="url(#{sid}-area-grad)" opacity="0" />
<path class="{sid}-chart-line" d="M 110 352 C 300 345, 580 325, 870 298" fill="none" stroke="rgba(167,139,250,0.55)" stroke-width="3" stroke-dasharray="8 6" />
<path class="{sid}-chart-line" d="M 110 340 C 230 315, 270 275, 350 255 C 470 225, 510 190, 610 165 C 730 135, 780 95, 870 78" fill="none" stroke="#38bdf8" stroke-width="6" stroke-linecap="round" />
{"".join(dots_svg)}
</svg>
</div>
<div class="chart-gauges-col">{"".join(gauges_html)}</div>
</div>
</div>"""
def _render_custom_viz_stage_scene(slide: dict[str, Any], s_idx: int, project_dir: Path) -> str:
"""Mounts bespoke SVG/HTML diagrams produced by Anatomy, Archify, or Agent Anime.js code."""
sid = f"s{s_idx + 1}"
media_dir = project_dir / "assets" / "media"
media_dir.mkdir(parents=True, exist_ok=True)
archify_spec = (slide.get("archify_json") or "").strip()
custom_html = (slide.get("custom_html") or "").strip()
custom_svg = (slide.get("custom_svg") or "").strip()
# 1. Optional auto-compile via bundled viz_skills/archify/bin/archify.mjs if archify_json is provided
if archify_spec and not custom_html:
parts = archify_spec.split(":", 1) if ":" in archify_spec and not Path(archify_spec).exists() else ["architecture", archify_spec]
diag_type, json_path_s = parts[0].strip(), parts[1].strip()
json_p = Path(json_path_s).expanduser()
archify_bin = PIPELINE_ROOT / "viz_skills" / "archify" / "bin" / "archify.mjs"
node_bin = shutil.which("node")
if json_p.exists() and archify_bin.exists() and node_bin:
out_html = media_dir / f"s{s_idx + 1:02d}_archify.html"
try:
subprocess.run(
[node_bin, str(archify_bin), "render", diag_type, str(json_p.resolve()), str(out_html)],
check=True,
capture_output=True,
timeout=15,
)
custom_html = str(out_html)
except Exception as exc:
print(f"[Archify Info] CLI render skipped ({exc}); using built-in architecture renderer.")
stage_inner = ""
if custom_html:
html_p = Path(custom_html).expanduser()
if html_p.exists():
dst_html = media_dir / f"s{s_idx + 1:02d}_viz.html"
shutil.copy2(html_p, dst_html)
stage_inner = f'<iframe src="assets/media/{dst_html.name}?theme=dark" class="custom-viz-iframe" data-layout-ignore></iframe>'
elif "<svg" in custom_html.lower() or "<div" in custom_html.lower():
stage_inner = f'<div id="{sid}-custom-svg-host" class="custom-svg-host" data-layout-ignore>{custom_html}</div>'
elif custom_svg:
svg_p = Path(custom_svg).expanduser() if not custom_svg.lstrip().startswith("<") else None
svg_markup = svg_p.read_text(encoding="utf-8") if (svg_p and svg_p.exists()) else custom_svg
stage_inner = f'<div id="{sid}-custom-svg-host" class="custom-svg-host" data-layout-ignore>{svg_markup}</div>'
if not stage_inner:
return _render_archify_architecture_scene(slide, s_idx)
return f"""
<div id="{sid}-inner" class="scene-inner scene-custom-viz">
<div class="arch-head-bar">
<div class="top-pill"><span class="pill-dot"></span><span>{_esc(slide.get("badge", "CUSTOM VISUALIZATION"))}</span></div>
<h2 class="arch-main-title">{_esc(slide.get("title", "심화 시각화 다이어그램"))}</h2>
</div>
<div id="{sid}-viz-frame" class="custom-viz-frame">
{stage_inner}
</div>
</div>"""
def _render_changelog_vertical_scene(slide: dict[str, Any], s_idx: int) -> str:
sid = f"s{s_idx + 1}"
bullets = (slide.get("bullets") or ["11.03 | v2.29 | 음성 모드 배포", "11.09 | v2.30 | 지식 업무 레이아웃"])[:6]
row_colors = ["#38bdf8", "#34d399", "#2dd4bf", "#fbbf24", "#a78bfa", "#fb7185"]
rows_html = []
for i, raw in enumerate(bullets):
parts = [x.strip() for x in raw.split("|")]
if len(parts) >= 3:
dt_txt, ver_txt, desc_txt = parts[0], parts[1], " · ".join(parts[2:])
elif len(parts) == 2:
dt_txt, ver_txt, desc_txt = parts[0], f"STEP {i + 1}", parts[1]
else:
dt_txt, ver_txt, desc_txt = f"0{i + 1}", "UPDATE", parts[0]
col = row_colors[i % len(row_colors)]
rows_html.append(f"""
<div id="{sid}-clog-{i}" class="clog-row">
<div class="clog-date" style="color:{col};">{_esc(dt_txt)}</div>
<div class="clog-dot-wrap" data-layout-ignore>
<span class="clog-dot" style="background:{col}; box-shadow:0 0 14px {col};"></span>
</div>
<div class="clog-ver">{_esc(ver_txt)}</div>
<div class="clog-desc">{_esc(desc_txt)}</div>
</div>""")
src_html = (
f'<div class="slide-source-foot">{_esc(slide["source_note"])}</div>'
if slide.get("source_note")
else ""
)
return f"""
<div id="{sid}-inner" class="scene-inner scene-changelog">
<div class="clog-header">{_esc(slide.get("title", "핵심 변경 기록"))}</div>
<div class="clog-body">
<div id="{sid}-clog-spine" class="clog-spine" data-layout-ignore></div>
<div class="clog-rows-wrap">{"".join(rows_html)}</div>
</div>
{src_html}
</div>"""
def _render_mission_staircase_scene(slide: dict[str, Any], s_idx: int) -> str:
sid = f"s{s_idx + 1}"
bullets = list(slide.get("bullets") or [])
while len(bullets) < 5:
bullets.append(f"MISSION {len(bullets) + 1} | 단계 {len(bullets) + 1} | 실전 적용")
items = bullets[:5]
colors = ["#34d399", "#38bdf8", "#a78bfa", "#fbbf24", "#fb7185"]
list_rows = []
blocks_html = []
for i, raw in enumerate(items):
parts = [x.strip() for x in raw.split("|")]
if len(parts) >= 3:
m_tag, m_head, m_sub = parts[0], parts[1], parts[2]
elif len(parts) == 2:
m_tag, m_head, m_sub = f"MISSION {i + 1}", parts[0], parts[1]
else:
m_tag, m_head, m_sub = f"MISSION {i + 1}", parts[0], ""
c = colors[i]
list_rows.append(f"""
<div id="{sid}-mrow-{i}" class="mission-row">
<span class="mission-bar" style="background:{c};" data-layout-ignore></span>
<span class="mission-tag" style="color:{c};">{_esc(m_tag)}</span>
<span class="mission-head">{_esc(m_head)}</span>
<span class="mission-sub">{_esc(m_sub)}</span>
</div>""")
h_px = 95 + i * 68
blocks_html.append(f"""
<div id="{sid}-mblock-{i}" class="stair-col">
<div class="stair-top-label">{_esc(m_tag)}</div>
<div class="stair-cube" style="height:{h_px}px; border-color:{c}; background:linear-gradient(180deg, {c}26 0%, {c}0d 100%);"></div>
</div>""")
return f"""
<div id="{sid}-inner" class="scene-inner scene-staircase">
<div class="clog-header">{_esc(slide.get("title", "미션 5단계 로드맵"))}</div>
<div class="staircase-layout">
<div class="mission-list-col">{"".join(list_rows)}</div>
<div class="stair-3d-stage" data-layout-ignore>{"".join(blocks_html)}</div>
</div>
</div>"""
def _render_swarm_network_scene(slide: dict[str, Any], s_idx: int) -> str:
sid = f"s{s_idx + 1}"
bullets = list(slide.get("bullets") or [])
default_nodes = ["@worker-1 | 프론트엔드", "@worker-2 | 백엔드", "@worker-3 | 데이터", "@worker-4 | 문서화", "@verifier | 품질 검증"]
while len(bullets) < 5:
bullets.append(default_nodes[len(bullets)])
nodes = bullets[:5]
# Precomputed radial coordinates around center (520, 250) inside 920x500 graph box
coords = [(190, 95), (810, 95), (150, 390), (830, 385), (500, 445)]
node_colors = ["#38bdf8", "#34d399", "#a78bfa", "#2dd4bf", "#fbbf24"]
lines_svg = []
nodes_html = []
for i, raw in enumerate(nodes):
n_name, n_role = _split_card_item(raw, i)
nx, ny = coords[i]
col = node_colors[i % len(node_colors)]
lines_svg.append(
f'<line x1="490" y1="235" x2="{nx}" y2="{ny}" stroke="{col}" stroke-opacity="0.45" stroke-width="2" stroke-dasharray="6 6" />'
)
nodes_html.append(f"""
<div id="{sid}-snode-{i}" class="swarm-node" style="left:{nx - 85}px; top:{ny - 42}px; border-color:{col};">
<span class="swarm-orb" style="background:{col}; box-shadow:0 0 18px {col};"></span>
<div class="swarm-node-copy">
<div class="swarm-node-id">{_esc(n_name)}</div>
<div class="swarm-node-role">{_esc(n_role[:14])}</div>
</div>
</div>""")
hero_kw = slide.get("hero_word") or "/swarm"
return f"""
<div id="{sid}-inner" class="scene-inner scene-swarm">
<div class="swarm-left">
<div class="swarm-big-cmd">{_esc(hero_kw)}</div>
<div class="swarm-title">{_esc(slide.get("title", "프롬프트 한 줄 → AI 팀 동시 가동"))}</div>
<div class="swarm-sub">{_esc(slide.get("highlight_quote") or "지휘자 · 작업자 · 검증자가 공용 보드에서 병렬 협업")}</div>
</div>
<div class="swarm-graph-box">
<svg class="swarm-svg" viewBox="0 0 960 520" data-layout-ignore>
{"".join(lines_svg)}
</svg>
<div id="{sid}-swarm-hub" class="swarm-hub-core">
<div class="hub-ring"></div>
<div class="hub-tag">COORDINATOR</div>
<div class="hub-name">총괄 지휘</div>
</div>
{"".join(nodes_html)}
</div>
</div>"""
def _render_pricing_matrix_scene(slide: dict[str, Any], s_idx: int) -> str:
sid = f"s{s_idx + 1}"
plans_raw = [p.strip() for p in slide.get("plans", "무료 ₩0 | Pro 월 ₩29,000 | Ultra 월 ₩119,000~").split("|") if p.strip()]
while len(plans_raw) < 3:
plans_raw.append(f"Plan {len(plans_raw) + 1}")
plans = plans_raw[:3]
plan_headers = []
h_colors = ["#94a3b8", "#38bdf8", "#fbbf24"]
for pi, p_txt in enumerate(plans):
words = p_txt.split()
p_top = " ".join(words[:-1]) if len(words) >= 2 else f"TIER {pi + 1}"
p_price = words[-1] if words else p_txt
plan_headers.append(f"""
<div class="pm-plan-head" style="border-color:{h_colors[pi]};">
<div class="pm-plan-tier" style="color:{h_colors[pi]};">{_esc(p_top)}</div>
<div class="pm-plan-price">{_esc(p_price)}</div>
</div>""")
bullets = (slide.get("bullets") or [
"지식 업무 · 음성 모드 | ✓ | ✓ | ✓",
"고속 경량 모델 | △ | ✓ | ✓",
"멀티 에이전트 /swarm | ✕ | ✓ | ✓",
"최상위 추론 오케스트레이터 | ✕ | ✕ | ✓",
])[:5]
def _cell_markup(val: str) -> str:
v = val.strip().upper()
if v in ("✓", "O", "OK", "YES", "지원", "포함"):
return '<span class="pm-sym sym-ok">✓</span>'
if v in ("✕", "X", "NO", "미지원", "-"):
return '<span class="pm-sym sym-no">✕</span>'
if v in ("△", "일부", "제한"):
return '<span class="pm-sym sym-warn">△</span>'
return f'<span class="pm-sym-txt">{_esc(val.strip())}</span>'
rows_html = []
for ri, raw in enumerate(bullets):
cols = [c.strip() for c in raw.split("|")]
feat = cols[0]
c1 = cols[1] if len(cols) > 1 else "✓"
c2 = cols[2] if len(cols) > 2 else "✓"
c3 = cols[3] if len(cols) > 3 else "✓"
rows_html.append(f"""
<div id="{sid}-pm-row-{ri}" class="pm-row">
<div class="pm-feat">{_esc(feat)}</div>
<div class="pm-cell">{_cell_markup(c1)}</div>
<div class="pm-cell">{_cell_markup(c2)}</div>
<div class="pm-cell">{_cell_markup(c3)}</div>
</div>""")
src_html = f'<div class="slide-source-foot">{_esc(slide["source_note"])}</div>' if slide.get("source_note") else ""
return f"""
<div id="{sid}-inner" class="scene-inner scene-pricing">
<div class="clog-header">{_esc(slide.get("title", "요금제 및 지원 기능 비교"))}</div>
<div class="pm-table">
<div class="pm-head-row">
<div class="pm-feat-spacer">기능 구분</div>
{"".join(plan_headers)}
</div>
{"".join(rows_html)}
</div>
{src_html}
</div>"""
# ---------------------------------------------------------------------------
# Existing 10 v2.0 Scene Archetype HTML Renderers
# ---------------------------------------------------------------------------
def _render_arc_cards_scene(slide: dict[str, Any], s_idx: int) -> str:
sid = f"s{s_idx + 1}"
items = (slide.get("bullets") or ["기획 모듈 | 구조화", "모션 모듈 | 렌더링", "사운드 모듈 | 효과음"])[:9]
n_items = len(items)
mid = (n_items - 1) / 2.0
cards_html = []
for i, item in enumerate(items):
role_short, role_desc = _split_card_item(item, i)
offset = i - mid
rot_y = round(offset * -7.2, 2)
trans_z = round(-abs(offset) * 22.0, 1)
ascii_prefix = "".join(ch for ch in role_short if ch.isascii() and ch.isalnum())
badge_word = ascii_prefix[:3].upper() if len(ascii_prefix) >= 2 else role_short[:2]
cards_html.append(f"""
<div class="arc-slot" style="transform: perspective(1350px) rotateY({rot_y}deg) translateZ({trans_z}px);">
<article id="{sid}-arc-card-{i}" class="arc-card">
<div class="arc-avatar"><span>{_esc(badge_word)}</span></div>
<div class="arc-name">{_esc(role_short)}</div>
<div class="arc-desc">{_esc(role_desc[:16])}</div>
<div class="arc-status"><span class="status-dot"></span><span>ACTIVE</span></div>
</article>
</div>""")
return f"""
<div id="{sid}-inner" class="scene-inner scene-arc">
<div id="{sid}-pill" class="top-pill">
<span class="pill-dot"></span>
<span>{_esc(slide.get("badge", "AI SYNC ENGINE"))}</span>
</div>
<div id="{sid}-hero-stat" class="hero-stat-row">
<span class="stat-prefix">{_esc(slide.get("stat_prefix", "AI 모듈"))}</span>
<span id="{sid}-counter" class="stat-big-num">{int(slide.get("stat_number", n_items))}</span>
<span class="stat-suffix">{_esc(slide.get("stat_suffix", "종"))}</span>
</div>
<div class="arc-stage">{"".join(cards_html)}</div>
</div>"""
def _render_mockup_steps_scene(slide: dict[str, Any], s_idx: int) -> str:
sid = f"s{s_idx + 1}"
raw_items = list(slide.get("bullets") or [])
while len(raw_items) < 3:
raw_items.append(f"핵심 포인트 {len(raw_items) + 1} | 자동 동기화 처리")
step_items = raw_items[:3]
right_cards = []
left_rows = []
for i, raw in enumerate(step_items):
head, desc = _split_card_item(raw, i)
right_cards.append(f"""
<article id="{sid}-step-card-{i}" class="step-card">
<div class="step-icon-ring"><span>{i + 1:02d}</span></div>
<div class="step-text-col">
<div class="step-head">{_esc(head)}</div>
<div class="step-sub">{_esc(desc)}</div>
</div>
</article>""")
left_rows.append(f"""
<div id="{sid}-mock-row-{i}" class="mock-chat-row">
<div class="mock-avatar">S{i + 1}</div>
<div class="mock-lines">
<div class="mock-line-title">{_esc(head[:16])}</div>
<div class="mock-bar-track" data-layout-ignore><div class="mock-bar-fill" style="width: {60 + i * 16}%;"></div></div>
</div>
<div class="mock-badge">{i + 1}</div>
</div>""")
return f"""
<div id="{sid}-inner" class="scene-inner scene-split">
<div id="{sid}-left-mock" class="mock-phone-panel">
<div class="mock-header">
<span class="mock-blue-dot"></span>
<span class="mock-header-title">{_esc(slide.get("badge", "Slide Sync Monitor"))}</span>
</div>
<div class="mock-body">{"".join(left_rows)}</div>
</div>
<div class="steps-col">{"".join(right_cards)}</div>
</div>"""
def _render_book_quote_scene(slide: dict[str, Any], s_idx: int) -> str:
sid = f"s{s_idx + 1}"
quote = slide.get("highlight_quote") or slide.get("title", "")
bullets = slide.get("bullets") or []
left_p1 = bullets[0] if len(bullets) > 0 else "반복되는 발표 자료 제작 과정을 분석해 일관된 시각 시스템으로 정의합니다."
left_p2 = bullets[1] if len(bullets) > 1 else "폰트 크기, 여백, 챕터 표시줄, 효과음 타이밍이 하나의 규칙 파일로 통합됩니다."
return f"""
<div id="{sid}-inner" class="scene-inner scene-book">
<div id="{sid}-pill" class="top-pill">
<span class="pill-dot"></span>
<span>{_esc(slide.get("badge", "CHAPTER · CORE PRINCIPLE"))}</span>
</div>
<div class="book-perspective-wrap" style="perspective: 1600px;">
<div id="{sid}-book-shell" class="book-hardcover-shell">
<div id="{sid}-book-spread" class="book-spread">
<div class="book-page book-page-left">
<div class="book-kicker">EDITION · WORKFLOW MANUAL</div>
<div class="book-left-title">{_esc(slide.get("title", ""))}</div>
<p class="book-para">{_esc(left_p1)}</p>
<p class="book-para">{_esc(left_p2)}</p>
<div class="book-page-num">104</div>
</div>
<div class="book-spine" data-layout-ignore></div>
<div id="{sid}-right-leaf" class="book-page book-page-right">
<div class="book-ribbon" data-layout-ignore></div>
<div class="book-kicker">KEY INSIGHT · HIGHLIGHT</div>
<div class="book-quote-box">
<div id="{sid}-hl-bar" class="book-hl-bar" data-layout-ignore></div>
<p class="book-quote-text">{_esc(quote)}</p>
</div>
<p class="book-para">한 번 검증된 모션과 사운드 설계는 코드 템플릿으로 자산화되어 다음 교안에서도 오차 없이 재현됩니다.</p>
<div class="book-page-num right">105</div>
</div>
</div>
</div>
</div>
</div>"""
def _render_notebook_flip_scene(slide: dict[str, Any], s_idx: int) -> str:
sid = f"s{s_idx + 1}"
bullets = list(slide.get("bullets") or [])
while len(bullets) < 4:
bullets.append(f"실전 점검 항목 {len(bullets) + 1} | 발표 전 자동 동기화 확인")
items = bullets[:4]
rings_html = "".join('<span class="nb-ring"></span>' for _ in range(7))
check_rows = []
for i, raw in enumerate(items):
head, desc = _split_card_item(raw, i)
check_rows.append(f"""
<div id="{sid}-nb-item-{i}" class="nb-check-row">
<span id="{sid}-nb-chk-{i}" class="nb-check-box">✓</span>
<div class="nb-check-copy">
<div class="nb-check-title">{_esc(head)}</div>
<div class="nb-check-desc">{_esc(desc)}</div>
</div>
</div>""")
return f"""
<div id="{sid}-inner" class="scene-inner scene-notebook">
<div id="{sid}-nb-wrap" class="nb-shell">
<div class="nb-tabs" data-layout-ignore>
<span class="nb-tab tab-1">01</span>
<span class="nb-tab tab-2">02</span>
<span class="nb-tab tab-3">03</span>
</div>
<div class="nb-page nb-left">
<div class="nb-tag">FIELD PLAYBOOK · NOTE</div>
<div class="nb-main-title">{_esc(slide.get("title", ""))}</div>
<div class="nb-callout">
<div class="nb-callout-head">핵심 가이드</div>
<p class="nb-callout-body">{_esc(slide.get("highlight_quote") or items[0])}</p>
</div>
<div class="nb-foot">ACTIONABLE CHECKLIST</div>
</div>
<div class="nb-rings-col" data-layout-ignore>{rings_html}</div>
<div class="nb-page nb-right">
<div class="nb-tag">VERIFICATION STEPS</div>
<div class="nb-checklist">{"".join(check_rows)}</div>
</div>
</div>
</div>"""
def _render_bento_grid_scene(slide: dict[str, Any], s_idx: int) -> str:
sid = f"s{s_idx + 1}"
bullets = list(slide.get("bullets") or [])
while len(bullets) < 4:
bullets.append(f"모듈 기능 {len(bullets) + 1} | 실시간 고해상도 자동 처리")
b0_h, b0_d = _split_card_item(bullets[0], 0)
b1_h, b1_d = _split_card_item(bullets[1], 1)
b2_h, b2_d = _split_card_item(bullets[2], 2)
b3_h, b3_d = _split_card_item(bullets[3], 3)
return f"""
<div id="{sid}-inner" class="scene-inner scene-bento">
<div class="bento-grid-12">
<article id="{sid}-bento-0" class="bento-tile bento-span-7 bento-hero">
<div class="bento-kicker">{_esc(slide.get("badge", "CORE ARCHITECTURE"))}</div>
<div class="bento-hero-title">{_esc(slide.get("title", b0_h))}</div>
<div class="bento-hero-sub">{_esc(b0_h)} · {_esc(b0_d)}</div>
</article>
<article id="{sid}-bento-1" class="bento-tile bento-span-5">
<div class="bento-num-pill">01</div>
<div class="bento-tile-title">{_esc(b1_h)}</div>
<div class="bento-tile-desc">{_esc(b1_d)}</div>
</article>
<article id="{sid}-bento-2" class="bento-tile bento-span-6">
<div class="bento-num-pill">02</div>
<div class="bento-tile-title">{_esc(b2_h)}</div>
<div class="bento-tile-desc">{_esc(b2_d)}</div>
</article>
<article id="{sid}-bento-3" class="bento-tile bento-span-6">
<div class="bento-num-pill">03</div>
<div class="bento-tile-title">{_esc(b3_h)}</div>
<div class="bento-tile-desc">{_esc(b3_d)}</div>
</article>
</div>
</div>"""
def _render_vs_comparison_scene(slide: dict[str, Any], s_idx: int) -> str:
sid = f"s{s_idx + 1}"
bullets = list(slide.get("bullets") or [])
while len(bullets) < 4:
bullets.append(f"비교 항목 {len(bullets) + 1} | 생산성 및 품질 대폭 향상")
mid = max(1, len(bullets) // 2)
left_items = bullets[:mid][:3]
right_items = bullets[mid:][:3] or [bullets[-1]]
left_html = "".join(
f'<div class="vs-row"><span class="vs-mark vs-minus">–</span><span>{_esc(it.replace("|", " · "))}</span></div>'
for it in left_items
)
right_html = "".join(
f'<div class="vs-row"><span class="vs-mark vs-plus">✓</span><span>{_esc(it.replace("|", " · "))}</span></div>'
for it in right_items
)
left_tag = slide.get("flow_left_sub") if slide.get("flow_left_sub") != "PPTX · DOCX · MD · HTML" else "CASE A · 우려 및 한계"
left_head = slide.get("flow_left") if slide.get("flow_left") != "원본 교안 문서" else "기존 통념 · 주의 요인"
right_tag = slide.get("flow_right_sub") if slide.get("flow_right_sub") != "HTML 렌더링 + 효과음 싱크" else "CASE B · 검증된 해법"
right_head = slide.get("flow_right") if slide.get("flow_right") != "1080p 모션 MP4" else "핵심 대안 · 최종 결론"
return f"""
<div id="{sid}-inner" class="scene-inner scene-vs">
<div class="top-pill"><span class="pill-dot"></span><span>{_esc(slide.get("title", "핵심 비교 분석"))}</span></div>
<div class="vs-stage">
<article id="{sid}-vs-left" class="vs-card vs-asis">
<div class="vs-tag asis-tag">{_esc(left_tag)}</div>
<div class="vs-card-title">{_esc(left_head)}</div>
<div class="vs-list">{left_html}</div>
</article>
<div id="{sid}-vs-badge" class="vs-center-orb">VS</div>
<article id="{sid}-vs-right" class="vs-card vs-tobe">
<div class="vs-tag tobe-tag">{_esc(right_tag)}</div>
<div class="vs-card-title">{_esc(right_head)}</div>
<div class="vs-list">{right_html}</div>
</article>
</div>
</div>"""
def _render_data_bars_scene(slide: dict[str, Any], s_idx: int) -> str:
sid = f"s{s_idx + 1}"
bullets = (slide.get("bullets") or ["초기 기획 | 85%", "모션 자동화 | 96%", "렌더링 속도 | 92%"])[:4]
parsed_rows = []
max_num = 100.0
for idx, b in enumerate(bullets):
head, desc = _split_card_item(b, idx)
m = re.search(r"(\d+(?:\.\d+)?)\s*(%|배|분|초|시간|건|개|종|점|x)?", f"{head} {desc}")
val = float(m.group(1)) if m else float(68 + idx * 10)
unit = (m.group(2) if m and m.group(2) else "%")
max_num = max(max_num, val)
parsed_rows.append((head, desc, val, unit))
bars_html = []
for i, (head, desc, val, unit) in enumerate(parsed_rows):
pct = max(18, min(100, int(round((val / max_num) * 100))))
disp_num = int(val) if val.is_integer() else round(val, 1)
bars_html.append(f"""
<div id="{sid}-bar-row-{i}" class="bar-row-card">
<div class="bar-label-row">
<div class="bar-title-group">
<span class="bar-idx">0{i + 1}</span>
<span class="bar-head">{_esc(head)}</span>
<span class="bar-desc">{_esc(desc[:26])}</span>
</div>
<div class="bar-val-badge">{disp_num}{_esc(unit)}</div>
</div>
<div class="bar-track" data-layout-ignore>
<div id="{sid}-bar-fill-{i}" class="bar-fill" style="width: {pct}%;"></div>
</div>
</div>""")
return f"""
<div id="{sid}-inner" class="scene-inner scene-bars">
<div class="top-pill"><span class="pill-dot"></span><span>{_esc(slide.get("title", "핵심 성과 지표"))}</span></div>
<div class="bars-stack">{"".join(bars_html)}</div>
</div>"""
def _render_process_timeline_scene(slide: dict[str, Any], s_idx: int) -> str:
sid = f"s{s_idx + 1}"
bullets = list(slide.get("bullets") or [])
while len(bullets) < 4:
bullets.append(f"단계 {len(bullets) + 1} | 자동 검증 및 실행")
steps = bullets[:4]
nodes_html = []
for i, raw in enumerate(steps):
head, desc = _split_card_item(raw, i)
nodes_html.append(f"""
<article id="{sid}-tl-node-{i}" class="tl-step-card">
<div class="tl-step-circle">0{i + 1}</div>
<div class="tl-step-title">{_esc(head)}</div>
<div class="tl-step-desc">{_esc(desc)}</div>
</article>""")
return f"""
<div id="{sid}-inner" class="scene-inner scene-roadmap">
<div class="top-pill"><span class="pill-dot"></span><span>{_esc(slide.get("title", "실행 로드맵"))}</span></div>
<div class="tl-track-wrap">
<div class="tl-rail-bg" data-layout-ignore>
<div id="{sid}-tl-beam" class="tl-rail-beam"></div>
</div>
<div class="tl-cards-row">{"".join(nodes_html)}</div>
</div>
</div>"""
def _render_terminal_flow_scene(slide: dict[str, Any], s_idx: int) -> str:
sid = f"s{s_idx + 1}"
cmd_str = slide.get("command", "deck2video --input lecture.pptx --sfx on")
f_left = slide.get("flow_left", "원본 교안 문서")
f_left_sub = slide.get("flow_left_sub", "PPTX · DOCX · MD · HTML")
f_right = slide.get("flow_right", "1080p 모션 MP4")
f_right_sub = slide.get("flow_right_sub", "HTML 렌더링 + 효과음 싱크")
return f"""
<div id="{sid}-inner" class="scene-inner scene-terminal">
<div class="term-badges-row">
<div id="{sid}-badge-a" class="top-pill"><span>CLI 자동화 엔진</span></div>
<div id="{sid}-badge-b" class="top-pill accent"><span>SFX · 자막 실시간 합성</span></div>
</div>
<div id="{sid}-term-win" class="terminal-window">
<div class="term-titlebar">
<div class="term-dots" data-layout-ignore>
<span class="tdot"></span><span class="tdot"></span><span class="tdot"></span>
</div>
<div class="term-title">Deck2Video Motion Compiler v3.0</div>
</div>
<div class="term-content">
<div class="term-prompt-row">
<span class="term-chevron">></span>
<div id="{sid}-cmd-clip" class="term-cmd-reveal">
<span class="term-cmd-text">{_esc(cmd_str)}</span>
</div>
<span id="{sid}-caret" class="term-caret" data-layout-ignore></span>
</div>
<div id="{sid}-term-log" class="term-log-line">
✓ 문서 구조 파싱 완료 → 16종 모션 아키타입 매핑 → 10종 UI 효과음 믹싱 → 1080p 렌더링
</div>
</div>
</div>
<div class="flow-nodes-row">
<div id="{sid}-node-l" class="flow-node active-node">
<div class="flow-node-tag">INPUT</div>
<div class="flow-node-title">{_esc(f_left)}</div>
<div class="flow-node-sub">{_esc(f_left_sub)}</div>
</div>
<div class="flow-connector" data-layout-ignore>
<div class="flow-line"></div>
<div id="{sid}-pulse-dot" class="flow-pulse-dot"></div>
</div>
<div id="{sid}-node-r" class="flow-node">
<div class="flow-node-tag">OUTPUT</div>
<div class="flow-node-title">{_esc(f_right)}</div>
<div class="flow-node-sub">{_esc(f_right_sub)}</div>
</div>
</div>
</div>"""
def _render_metric_summary_scene(slide: dict[str, Any], s_idx: int) -> str:
sid = f"s{s_idx + 1}"
raw_items = list(slide.get("bullets") or [])
while len(raw_items) < 3:
raw_items.append(f"핵심 단계 {len(raw_items) + 1} | 원스톱 파이프라인")
pillars_html = []
for i, raw in enumerate(raw_items[:3]):
head, desc = _split_card_item(raw, i)
pillars_html.append(f"""
<article id="{sid}-pillar-{i}" class="pillar-card">
<div class="pillar-num">{i + 1:02d}</div>
<div class="pillar-ring"><span class="pillar-ring-dot"></span></div>
<div class="pillar-title">{_esc(head)}</div>
<div class="pillar-desc">{_esc(desc)}</div>
</article>""")
sub_summary = slide.get("subtitle") or slide.get("title", "핵심 요약 · 3단계 자동화")
return f"""
<div id="{sid}-inner" class="scene-inner scene-pillars">
<div class="pillars-grid">{"".join(pillars_html)}</div>
<div id="{sid}-summary-foot" class="pillars-footer">
<span class="pill-dot"></span>
<span>{_esc(sub_summary)}</span>
</div>
</div>"""
def _format_kinetic_tokens(text: str) -> str:
tokens = text.split()
out = []
for tok in tokens:
if re.search(r"\d+|['\"“”‘’]", tok):
out.append(f'<span class="kin-accent">{_esc(tok)}</span>')
else:
out.append(_esc(tok))
return " ".join(out)
def _stage_slide_media(raw_media_src: str, project_dir: Path, s_idx: int) -> tuple[str, str]:
"""Copies external video/image into `project_dir/assets/media/` and returns `(rel_path, kind)`."""
if not raw_media_src:
return "", "none"
cand = Path(raw_media_src).expanduser()
if not cand.is_absolute():
for base in (Path.cwd(), PIPELINE_ROOT, PIPELINE_ROOT.parent):
if (base / cand).exists():
cand = (base / cand).resolve()
break
if not cand.exists():
return "", "none"
ext = cand.suffix.lower()
media_dir = project_dir / "assets" / "media"
media_dir.mkdir(parents=True, exist_ok=True)
dst_name = f"s{s_idx + 1:02d}_{cand.name}"
dst = media_dir / dst_name
if not dst.exists() or dst.stat().st_size != cand.stat().st_size:
shutil.copy2(cand, dst)
if ext in (".mp4", ".webm", ".mov", ".m4v"):
return f"assets/media/{dst_name}", "video"
if ext in (".png", ".jpg", ".jpeg", ".webp", ".gif", ".svg"):
return f"assets/media/{dst_name}", "image"
return "", "none"
def compile_hyperframes_project(spec: dict[str, Any], project_dir: Path, offline: bool = True) -> Path:
fonts_dst = project_dir / "assets" / "fonts"
js_dst = project_dir / "assets" / "js"
fonts_dst.mkdir(parents=True, exist_ok=True)
js_dst.mkdir(parents=True, exist_ok=True)
font_src, gsap_src = _ensure_static_vendor_assets(offline=offline)
if font_src.exists():
shutil.copy2(font_src, fonts_dst / "PretendardVariable.woff2")
if gsap_src.exists():
shutil.copy2(gsap_src, js_dst / "gsap.min.js")
player_src = PIPELINE_ROOT / "assets" / "js" / "standalone_player.js"
if player_src.exists():
shutil.copy2(player_src, js_dst / "standalone_player.js")
anime_src = PIPELINE_ROOT / "assets" / "js" / "anime.min.js"
if anime_src.exists():
shutil.copy2(anime_src, js_dst / "anime.min.js")
requested_bg = (spec.get("bg_preset") or "horizon_wave").lower().strip()
all_text = " ".join(s.get("title", "") + " " + " ".join(s.get("bullets", [])) for s in spec.get("slides", []))
dark_cycle_keys = [
"wireframe_globe",
"isometric_hud_grid",
"horizon_wave",
"neural_constellation",
"aurora_mesh",
"blueprint_grid",
"vercel_spotlight",
"warm_editorial",
]
if requested_bg == "auto":
base_bg_key = auto_select_background(spec.get("title", ""), all_text)
elif requested_bg == "cycle":
base_bg_key = "isometric_hud_grid"
else:
base_bg_key = requested_bg if requested_bg in BACKGROUND_PRESETS else "horizon_wave"
theme = BACKGROUND_PRESETS[base_bg_key]
caption_style = (spec.get("caption_style") or "glass_dual").lower().strip()
hud_style = (spec.get("hud_style") or "chapter_tabs").lower().strip()
brand_label = spec.get("brand_label") or spec.get("title", "TECH BRIEFING · DEEP DIVE")
total_dur = spec["total_duration"]
chapters = spec.get("chapters", [])
# 1. Top HUD Layer (`chapter_tabs` vs `tech_briefing` vs `docu_watermark` vs `minimal`)
if hud_style == "tech_briefing":
hud_markup = f"""
<header class="briefing-hud">
<span class="briefing-brand">{_esc(brand_label)}</span>
<span id="briefing-cursor" class="briefing-cursor" data-layout-ignore>|</span>
</header>"""
elif hud_style == "docu_watermark":
if "|" in brand_label:
wm_top, wm_bot = [x.strip() for x in brand_label.split("|", 1)]
else:
words = brand_label.strip().split()
if len(words) >= 2:
wm_top, wm_bot = " ".join(words[:-1]), words[-1]
else:
wm_top, wm_bot = "DOCUMENTARY", brand_label.strip()[:12]
hud_markup = f"""
<div class="docu-top-bar" data-layout-ignore>
<div id="docu-prog-fill" class="docu-top-fill"></div>
</div>
<header class="docu-wm-hud">
<span class="docu-wm-top">{_esc(wm_top)}</span>
<span class="docu-wm-bot">{_esc(wm_bot)}</span>
</header>"""
elif hud_style == "deepfact_hud":
df_brand = brand_label.split("|")[0].strip() if brand_label else "딥팩트랩"
if len(df_brand) > 16:
df_brand = df_brand[:14]
first_ctx = ""
if spec.get("slides"):
s0 = spec["slides"][0]
first_ctx = (
s0.get("badge")
if s0.get("badge") and not s0.get("badge", "").startswith("SECTION")
else (s0.get("source_note") or s0.get("subtitle") or "팩트 검증 · 설명용 자료")
)
hud_markup = f"""
<header class="deepfact-hud">
<span class="deepfact-logo">{_esc(df_brand)}</span>
<div id="deepfact-ctx-box" class="deepfact-ctx-badge" data-layout-ignore>
<span id="deepfact-ctx-text">{_esc(first_ctx[:34])}</span>
</div>
</header>"""
elif hud_style == "minimal":
hud_markup = ""
else:
chapter_tabs_html = [
f"""
<div id="chap-tab-{c_idx}" class="chap-tab">
<div class="chap-tab-row">
<span class="chap-num">{_esc(ch['num'])}</span>
<span class="chap-label">{_esc(ch['label'])}</span>
</div>
<div class="chap-bar-bg" data-layout-ignore>
<div id="chap-fill-{c_idx}" class="chap-bar-fill"></div>
</div>
</div>"""
for c_idx, ch in enumerate(chapters)
]
hud_markup = f'<header class="chapter-hud">{"".join(chapter_tabs_html)}</header>'
# 2. Scene Clips (Track 0) + Sibling Embedded Video Overlays (Track 5)
scenes_html = []
video_overlays_html = []
slide_bg_keys = []
scramble_targets: list[dict[str, Any]] = []
for s_idx, slide in enumerate(spec["slides"]):
arch = slide["archetype"]
if slide.get("bg_preset") and slide["bg_preset"] in BACKGROUND_PRESETS:
s_bg = slide["bg_preset"]
elif arch == "hero_3d_briefing" and requested_bg in ("auto", "isometric_hud_grid"):
s_bg = "wireframe_globe"
elif requested_bg == "cycle":
s_bg = dark_cycle_keys[s_idx % len(dark_cycle_keys)]
else:
s_bg = base_bg_key
slide_bg_keys.append(s_bg)
rel_media, media_kind = _stage_slide_media(slide.get("media_src", ""), project_dir, s_idx)
if arch == "hero_3d_briefing":
inner_markup = _render_hero_3d_briefing_scene(slide, s_idx)
elif arch == "media_showcase_split":
inner_markup = _render_media_showcase_split_scene(slide, s_idx, rel_media, media_kind)
scram_txt = slide.get("scramble_text") or slide.get("subtitle") or (
slide["bullets"][1] if len(slide.get("bullets", [])) > 1 else slide.get("title", "")
)
scramble_targets.append({"id": f"s{s_idx + 1}-scramble", "text": scram_txt, "start": slide["start"] + 0.2})
if media_kind == "video" and rel_media:
video_overlays_html.append(f"""
<video
id="showcase-vid-{s_idx + 1}"
class="clip showcase-video-overlay"
src="{_esc(rel_media)}"
muted
playsinline
data-start="{slide['start']}"
data-duration="{slide['duration']}"
data-track-index="5"
></video>""")
elif arch == "cinema_broll_fullscreen":
inner_markup = _render_cinema_broll_scene(slide, s_idx, rel_media, media_kind)
if media_kind == "video" and rel_media:
video_overlays_html.append(f"""
<video
id="broll-vid-{s_idx + 1}"
class="clip broll-video-overlay"
src="{_esc(rel_media)}"
muted
playsinline
data-start="{slide['start']}"
data-duration="{slide['duration']}"
data-track-index="5"
></video>""")
elif arch == "dossier_stamp_card":
inner_markup = _render_dossier_stamp_scene(slide, s_idx)
elif arch == "depth_cross_section":
inner_markup = _render_depth_cross_section_scene(slide, s_idx)
elif arch == "sonar_factcheck_map":
inner_markup = _render_sonar_factcheck_map_scene(slide, s_idx, rel_media, media_kind)
elif arch == "archify_architecture":
inner_markup = _render_archify_architecture_scene(slide, s_idx)
elif arch == "anatomy_mechanic":
inner_markup = _render_anatomy_mechanic_scene(slide, s_idx)
elif arch == "anime_svg_chart":
inner_markup = _render_anime_svg_chart_scene(slide, s_idx)
elif arch == "custom_viz_stage":
inner_markup = _render_custom_viz_stage_scene(slide, s_idx, project_dir)
elif arch == "changelog_vertical":
inner_markup = _render_changelog_vertical_scene(slide, s_idx)
elif arch == "mission_staircase":
inner_markup = _render_mission_staircase_scene(slide, s_idx)
elif arch == "swarm_network":
inner_markup = _render_swarm_network_scene(slide, s_idx)
elif arch == "pricing_matrix":
inner_markup = _render_pricing_matrix_scene(slide, s_idx)
elif arch == "arc_cards":
inner_markup = _render_arc_cards_scene(slide, s_idx)
elif arch == "mockup_steps":
inner_markup = _render_mockup_steps_scene(slide, s_idx)
elif arch == "book_quote":
inner_markup = _render_book_quote_scene(slide, s_idx)
elif arch == "notebook_flip":
inner_markup = _render_notebook_flip_scene(slide, s_idx)
elif arch == "bento_grid":
inner_markup = _render_bento_grid_scene(slide, s_idx)
elif arch == "vs_comparison":
inner_markup = _render_vs_comparison_scene(slide, s_idx)
elif arch == "data_bars":
inner_markup = _render_data_bars_scene(slide, s_idx)
elif arch == "process_timeline":
inner_markup = _render_process_timeline_scene(slide, s_idx)
elif arch == "terminal_flow":
inner_markup = _render_terminal_flow_scene(slide, s_idx)
else:
inner_markup = _render_metric_summary_scene(slide, s_idx)
scenes_html.append(f"""
<section
id="scene-clip-{s_idx + 1}"
class="clip scene-slot"
data-start="{slide['start']}"
data-duration="{slide['duration']}"
data-track-index="0"
>{inner_markup}
</section>""")
# 3. Subtitle Clips (Track 1) & Voiceover Audio (Track 2)
captions_html = []
vo_audio_html = []
karaoke_meta: list[dict[str, Any]] = []
hide_subtitles = (caption_style == "none") or bool(spec.get("disable_subtitles"))
for s_idx, slide in enumerate(spec["slides"]):
ch_num = f"{slide['chapter_index'] + 1:02d}"
for b_idx, beat in enumerate(slide["beats"]):
cid = f"cap-s{s_idx + 1}-b{b_idx + 1}"
has_next = b_idx + 1 < len(slide["beats"])
next_start = slide["beats"][b_idx + 1]["start"] if has_next else slide["end"]
next_is_cont = bool(slide["beats"][b_idx + 1].get("is_continuation")) if has_next else False
# Zero blink gap when transitioning mid-sentence into a continuation subtitle cue!
gap_trim = 0.0 if next_is_cont else 0.02
cap_dur = round(max(0.25, next_start - beat["start"] - gap_trim), 3)
b_lang = beat.get("lang") or spec.get("lang_code") or "ko"
sub_en_markup = f'<div class="cap-en">{_esc_balanced_sub(beat["sub_en"], "en")}</div>' if beat.get("sub_en") else ""
if not hide_subtitles:
balanced_ko = balance_subtitle_lines(beat["sub_ko"], lang=b_lang)
esc_balanced_ko = "<br class=\"cap-br\" />".join(_esc(ln_p) for ln_p in balanced_ko.split("\n"))
if caption_style == "pill_karaoke":
word_spans: list[str] = []
word_ids: list[str] = []
weights: list[int] = []
w_counter = 0
lines_ko = balanced_ko.split("\n")
for l_idx, ln_str in enumerate(lines_ko):
if l_idx > 0:
word_spans.append('<span class="kara-br" data-layout-ignore></span>')
for w_txt in ln_str.split():
if not w_txt:
continue
wid = f"{cid}-w-{w_counter}"
word_spans.append(f'<span id="{wid}" class="kara-word">{_esc(w_txt)}</span>')
word_ids.append(wid)
weights.append(max(1, len(w_txt)))
w_counter += 1
karaoke_meta.append({
"boxId": f"{cid}-box",
"start": beat["start"],
"duration": beat["duration"],
"wordIds": word_ids,
"weights": weights,
})
box_inner = f'<div class="kara-line">{"".join(word_spans)}</div>{sub_en_markup}'
box_cls = "caption-box style-karaoke"
elif caption_style == "briefing_clean":
box_inner = f'<div class="cap-ko briefing-ko">{esc_balanced_ko}</div>{sub_en_markup}'
box_cls = "caption-box style-briefing"
elif caption_style == "cinema_minimal":
box_inner = f'<div class="cap-ko cinema-text">{esc_balanced_ko}</div>{sub_en_markup}'
box_cls = "caption-box style-cinema"
elif caption_style == "docu_yellow_bar":
box_inner = f'<div class="df-cap-row"><span class="df-cap-bar" data-layout-ignore></span><span class="cap-ko df-cap-ko">{esc_balanced_ko}</span></div>{sub_en_markup}'
box_cls = "caption-box style-yellow-bar"
elif caption_style == "neon_bar_left":
box_inner = f"""
<div class="neon-bar-kicker">CHAPTER {ch_num} · {_esc(slide.get("title", "")[:18])}</div>
<div class="cap-ko">{esc_balanced_ko}</div>
{sub_en_markup}"""
box_cls = "caption-box style-neon-bar"
elif caption_style == "kinetic_pop":
kin_lines = "<br class=\"cap-br\" />".join(_format_kinetic_tokens(ln_p) for ln_p in balanced_ko.split("\n"))
box_inner = f'<div class="cap-ko kinetic-text">{kin_lines}</div>{sub_en_markup}'
box_cls = "caption-box style-kinetic"
else:
box_inner = f'<div class="cap-ko">{esc_balanced_ko}</div>{sub_en_markup}'
box_cls = "caption-box style-glass"
captions_html.append(f"""
<div
id="{cid}"
class="clip caption-slot"
data-start="{beat['start']}"
data-duration="{cap_dur}"
data-track-index="1"
data-layout-allow-caption-zone
>
<div id="{cid}-box" class="{box_cls}">
{box_inner}
</div>
</div>""")
if beat.get("src"):
aud_dur = beat.get("audio_duration") or beat["duration"]
vo_audio_html.append(f"""
<audio
id="{beat['id']}"
src="{_esc(beat['src'])}"
data-start="{beat['start']}"
data-duration="{aud_dur}"
data-track-index="2"
data-volume="1.0"
></audio>""")
sfx_audio_html = [
f"""
<audio
id="{ev['id']}"
src="{_esc(ev['src'])}"
data-start="{ev['start']}"
data-duration="{ev['duration']}"
data-track-index="3"
data-volume="{ev['volume']}"
></audio>"""
for ev in spec.get("sfx_events", [])
]
bgm_html = ""
if spec.get("bgm"):
bgm = spec["bgm"]
bgm_html = f"""
<audio
id="{bgm['id']}"
src="{_esc(bgm['src'])}"
data-start="{bgm['start']}"
data-duration="{bgm['duration']}"
data-track-index="4"
data-volume="{bgm['volume']}"
></audio>"""
choreo_payload = {
"totalDuration": total_dur,
"chaptersCount": len(chapters) if hud_style == "chapter_tabs" else 0,
"hudStyle": hud_style,
"captionStyle": caption_style,
"themeAccent": theme["accent"],
"themeAccentStrong": theme["accent_strong"],
"themeCardActive": theme["card_active"],
"karaoke": karaoke_meta,
"scrambles": scramble_targets,
"slides": [
{
"index": i,
"chapterIndex": s["chapter_index"],
"archetype": s["archetype"],
"bgPreset": slide_bg_keys[i],
"start": s["start"],
"duration": s["duration"],
"end": s["end"],
"statNumber": int(s.get("stat_number", 9)),
"bulletsCount": len(s.get("bullets", [])),
"contextBadge": (
s.get("badge")
if s.get("badge") and not s.get("badge", "").startswith("SECTION")
else (s.get("source_note") or s.get("subtitle") or s.get("title", "")[:26])
)[:34],
"beats": [
{
"start": b["start"],
"duration": b["duration"],
"end": b["end"],
"isContinuation": bool(b.get("is_continuation")),
}
for b in s["beats"]
],
}
for i, s in enumerate(spec["slides"])
],
}
choreo_json = json.dumps(choreo_payload, ensure_ascii=False)
is_light = theme["is_light"]
border_subtle = "rgba(15, 23, 42, 0.14)" if is_light else "rgba(148, 163, 184, 0.22)"
cinema_bg = "rgba(15, 23, 42, 0.88)" if is_light else "rgba(4, 6, 12, 0.84)"
scene_pad_bottom = "96px" if hide_subtitles else "176px"
showcase_vid_top = "292px" if hide_subtitles else "252px"
html_lang = _esc(spec.get("lang_code") or "ko")
word_break_rule = "keep-all" if html_lang in ("ko", "zh", "ja") else "normal"
html_doc = f"""<!doctype html>
<html lang="{html_lang}" data-resolution="landscape">
<head>
<meta charset="UTF-8" />
<meta http-equiv="Content-Security-Policy" content="default-src 'self' file: http://127.0.0.1:* http://localhost:* 'unsafe-inline' data: blob:; connect-src 'none';" />
<meta name="viewport" content="width=1920, height=1080" />
<title>{_esc(spec.get("title", "AI SYNC Presentation v4.4"))}</title>
<script src="assets/js/gsap.min.js"></script>
<script src="assets/js/anime.min.js"></script>
<style>
@font-face {{
font-family: "PretendardLocal";
src: url("assets/fonts/PretendardVariable.woff2") format("woff2-variations");
font-weight: 100 900;
font-style: normal;
font-display: block;
}}
:root {{
--bg-deep: {theme['bg_deep']};
--bg-card: {theme['card_bg']};
--bg-card-active: {theme['card_active']};
--hud-bg: {theme['hud_bg']};
--cap-bg: {theme['cap_bg']};
--border-subtle: {border_subtle};
--accent: {theme['accent']};
--accent-strong: {theme['accent_strong']};
--accent-soft: {theme['accent_soft']};
--pill-ink: {theme['pill_ink']};
--text-primary: {theme['text_primary']};
--text-secondary: {theme['text_secondary']};
--font-ui: "PretendardLocal", "PingFang SC", "Microsoft YaHei", "Hiragino Sans", "Yu Gothic", "Leelawadee UI", "Thonburi", "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans", sans-serif;
}}
* {{ margin: 0; padding: 0; box-sizing: border-box; }}
html, body {{
width: 1920px; height: 1080px; overflow: hidden;
background: var(--bg-deep); color: var(--text-primary);
font-family: var(--font-ui); word-break: {word_break_rule}; overflow-wrap: break-word;
-webkit-font-smoothing: antialiased;
}}
#root {{ position: relative; width: 100%; height: 1080px; overflow: hidden; background: var(--bg-deep); }}
.bg-atmosphere {{ position: absolute; inset: 0; background: {theme['bg_grad']}; pointer-events: none; }}
#wave-canvas {{ position: absolute; inset: 0; width: 1920px; height: 1080px; display: block; pointer-events: none; }}
/* HUD A: Chapter Tabs */
.chapter-hud {{
position: absolute; top: 26px; left: 64px; right: 64px; height: 62px; padding: 8px 14px;
border-radius: 18px; background: var(--hud-bg); border: 1px solid var(--border-subtle);
display: grid; grid-template-columns: repeat({max(1, len(chapters))}, 1fr); gap: 12px; align-items: center; z-index: 20;
}}
.chap-tab {{ height: 46px; padding: 6px 16px; border-radius: 12px; border: 1px solid transparent; display: flex; flex-direction: column; justify-content: center; gap: 6px; }}
.chap-tab-row {{ display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; overflow: hidden; }}
.chap-num {{ color: var(--accent); font-weight: 800; }}
.chap-bar-bg {{ width: 100%; height: 3px; border-radius: 99px; background: var(--border-subtle); overflow: hidden; }}
.chap-bar-fill {{ display: block; width: 100%; height: 100%; border-radius: 99px; background: var(--accent); transform-origin: left center; }}
/* HUD B: IT톡톡 Tech Briefing Header */
.briefing-hud {{
position: absolute; top: 42px; left: 100px; z-index: 20;
display: flex; align-items: center; gap: 6px;
font-size: 20px; font-weight: 600; letter-spacing: 0.22em; color: var(--text-secondary);
}}
.briefing-cursor {{ color: var(--accent); font-weight: 900; }}
/* HUD C: Documentary Watermark + Top Progress Bar (설명좋아하는아저씨 스타일) */
.docu-top-bar {{ position: absolute; top: 18px; left: 36px; right: 380px; height: 4px; border-radius: 99px; background: rgba(148, 163, 184, 0.24); overflow: hidden; z-index: 22; }}
.docu-top-fill {{ display: block; width: 100%; height: 100%; background: linear-gradient(90deg, #38bdf8, #34d399); transform-origin: left center; }}
.docu-wm-hud {{
position: absolute; top: 44px; right: 76px; z-index: 22;
display: flex; flex-direction: column; align-items: center; gap: 2px;
text-shadow: 0 2px 12px rgba(0,0,0,0.85);
}}
.docu-wm-top {{ font-size: 16px; font-weight: 800; color: #f8fafc; letter-spacing: -0.01em; }}
.docu-wm-bot {{ font-size: 38px; font-weight: 900; color: #ffffff; letter-spacing: -0.03em; line-height: 1.02; }}
/* HUD D: DeepFactLab Investigative HUD (Top-Left Bold Brand + Top-Right Speech Context Badge) */
.deepfact-hud {{
position: absolute; top: 34px; left: 42px; right: 42px; z-index: 24;
display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none;
}}
.deepfact-logo {{
font-size: 34px; font-weight: 900; color: #ffffff; letter-spacing: -0.04em;
text-shadow: 0 2px 12px rgba(0, 0, 0, 0.85);
}}
.deepfact-ctx-badge {{
position: relative; padding: 8px 18px; background: rgba(10, 15, 22, 0.86);
border: 1.4px solid rgba(226, 232, 240, 0.72); border-radius: 4px;
font-size: 18px; font-weight: 700; color: #f8fafc; letter-spacing: -0.01em;
}}
.deepfact-ctx-badge::after {{
content: ""; position: absolute; right: 12px; bottom: -8px; width: 12px; height: 8px;
background: rgba(10, 15, 22, 0.92); border-right: 1.4px solid rgba(226, 232, 240, 0.72);
border-bottom: 1.4px solid rgba(226, 232, 240, 0.72); transform: skewX(28deg);
}}
.hud-corner {{ position: absolute; width: 52px; height: 52px; border-color: rgba(96, 165, 250, 0.55); border-style: solid; pointer-events: none; }}
.hud-corner.tl {{ top: 48px; left: 56px; border-width: 2px 0 0 2px; }}
.hud-corner.tr {{ top: 48px; right: 56px; border-width: 2px 2px 0 0; }}
.hud-corner.bl {{ bottom: 150px; left: 56px; border-width: 0 0 2px 2px; }}
.hud-corner.br {{ bottom: 150px; right: 56px; border-width: 0 2px 2px 0; }}
/* Stage */
.scene-slot {{ position: absolute; inset: 0; padding: 104px 96px {scene_pad_bottom} 96px; display: flex; align-items: center; justify-content: center; z-index: 10; }}
.scene-inner {{ width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; position: relative; }}
.top-pill {{ display: inline-flex; align-items: center; gap: 10px; padding: 10px 24px; border-radius: 999px; background: var(--bg-card); border: 1.5px solid var(--accent-strong); font-size: 20px; font-weight: 700; color: var(--text-primary); }}
.pill-dot {{ display: block; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }}
.slide-source-foot {{ align-self: flex-start; font-size: 16px; font-weight: 500; color: var(--text-secondary); margin-top: 8px; }}
/* NEW 1: Hero 3D Briefing */
.hero3d-kicker {{ font-size: 26px; font-weight: 700; letter-spacing: 0.24em; color: var(--text-secondary); }}
.hero3d-title {{ font-size: 136px; font-weight: 900; letter-spacing: 0.04em; color: #ffffff; text-shadow: 0 0 48px rgba(59, 130, 246, 0.55); line-height: 1.05; text-align: center; }}
.hero3d-sub {{ font-size: 46px; font-weight: 800; color: #fde047; letter-spacing: -0.02em; text-align: center; }}
.hero3d-divider {{ width: 420px; height: 3px; background: linear-gradient(90deg, transparent, #60a5fa, transparent); }}
.hero3d-pills-row {{ display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 8px; }}
.hero-topic-pill {{ padding: 8px 22px; border-radius: 999px; border: 1.5px solid #38bdf8; font-size: 20px; font-weight: 700; color: #f8fafc; }}
.hero-meta-note {{ font-size: 17px; font-weight: 500; color: #cbd5e1; margin-top: 6px; }}
/* NEW 2: Media Showcase Split + Video Overlay */
.scene-media-split {{ flex-direction: row; justify-content: space-between; align-items: center; gap: 56px; }}
.media-left-col {{ flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 20px; max-width: 760px; }}
.split-quote {{ font-size: 40px; font-weight: 800; line-height: 1.32; color: var(--text-primary); }}
.split-giant-kw {{ font-size: 122px; font-weight: 900; line-height: 1.0; color: #ffffff; text-shadow: 0 0 42px rgba(56, 189, 248, 0.52); letter-spacing: -0.02em; }}
.split-scramble-line {{ font-size: 36px; font-weight: 800; color: var(--accent-soft); min-height: 48px; }}
.split-extra-note {{ font-size: 22px; font-weight: 600; color: var(--text-secondary); }}
.media-right-col {{ width: 820px; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; flex-shrink: 0; }}
.neon-media-frame {{
width: 820px; height: 462px; border-radius: 20px; background: rgba(8, 13, 26, 0.94);
border: 2px solid #38bdf8; box-shadow: 0 0 44px rgba(56, 189, 248, 0.26), 0 24px 60px rgba(0,0,0,0.55);
overflow: hidden; display: flex; align-items: center; justify-content: center;
}}
.neon-media-frame.video-host-hidden {{ background: transparent; border-color: transparent; box-shadow: none; }}
.showcase-media-img {{ width: 100%; height: 100%; object-fit: cover; display: block; }}
.showcase-video-placeholder {{ width: 100%; height: 100%; }}
.showcase-video-overlay {{
position: absolute; right: 96px; top: {showcase_vid_top}; width: 820px; height: 462px;
border-radius: 20px; border: 2px solid #38bdf8;
box-shadow: 0 0 44px rgba(56, 189, 248, 0.26), 0 24px 60px rgba(0,0,0,0.55);
object-fit: cover; z-index: 15; pointer-events: none;
}}
.media-caption-note {{ font-size: 17px; font-weight: 600; color: var(--text-secondary); }}
.showcase-sim-ui {{ width: 100%; height: 100%; padding: 28px 34px; display: flex; flex-direction: column; justify-content: space-between; background: #070b14; }}
.sim-top {{ display: flex; justify-content: space-between; font-size: 16px; font-weight: 700; color: #94a3b8; border-bottom: 1px solid rgba(148,163,184,0.18); padding-bottom: 14px; }}
.sim-rec {{ color: #f87171; }}
.sim-body {{ display: flex; flex-direction: column; gap: 18px; margin: auto 0; }}
.sim-line {{ padding: 18px 22px; border-radius: 14px; background: rgba(30, 41, 59, 0.72); border: 1px solid rgba(56, 189, 248, 0.35); display: flex; align-items: center; gap: 14px; font-size: 22px; font-weight: 700; color: #f8fafc; }}
.sim-dot {{ width: 10px; height: 10px; border-radius: 50%; background: #38bdf8; flex-shrink: 0; }}
/* NEW 2B: Documentary Dossier / Patent Stamp Card (설명좋아하는아저씨 스타일) */
.scene-dossier {{ justify-content: center; align-items: center; }}
.dossier-shell {{ width: 1440px; display: flex; flex-direction: column; align-items: flex-start; }}
.dossier-folder-tab {{
margin-left: 36px; padding: 10px 28px 8px 28px; border-radius: 14px 14px 0 0;
background: #ebd9bd; color: #7c2d12; font-size: 16px; font-weight: 900; letter-spacing: 0.06em;
}}
.dossier-card {{
position: relative; width: 100%; min-height: 500px; padding: 42px 58px 48px 58px;
border-radius: 18px; box-shadow: 0 32px 72px rgba(0,0,0,0.65);
display: flex; flex-direction: column; justify-content: space-between;
}}
.dossier-card-kraft {{ background: #ebd9bd; color: #1c1917; }}
.dossier-card-white {{ background: #f8fafc; color: #0f172a; border-top: 8px solid #0ea5e9; }}
.dossier-head-row {{ display: flex; justify-content: space-between; align-items: baseline; gap: 24px; }}
.dossier-title {{ font-size: 40px; font-weight: 900; letter-spacing: -0.03em; color: #0f172a; }}
.dossier-meta-right {{ font-size: 18px; font-weight: 700; font-family: monospace; color: #475569; }}
.dossier-divider {{ width: 100%; height: 2px; background: rgba(15, 23, 42, 0.75); margin: 18px 0 12px 0; }}
.dossier-rows {{ display: flex; flex-direction: column; gap: 6px; flex: 1; justify-content: center; }}
.dossier-row {{
display: grid; grid-template-columns: 220px 1fr; align-items: center; gap: 28px;
padding: 20px 8px; border-bottom: 1.5px dotted rgba(15, 23, 42, 0.28);
}}
.dossier-key {{ font-size: 24px; font-weight: 800; color: #7c2d12; }}
.dossier-card-white .dossier-key {{ color: #0369a1; }}
.dossier-val {{ font-size: 31px; font-weight: 900; color: #0f172a; letter-spacing: -0.02em; }}
.rubber-stamp {{
position: absolute; right: 56px; bottom: 38px; padding: 12px 28px;
border-radius: 10px; font-size: 36px; font-weight: 900; letter-spacing: 0.04em;
transform: rotate(-8deg); pointer-events: none;
}}
.stamp-red {{ border: 4px solid #dc2626; color: #dc2626; background: rgba(254, 226, 226, 0.35); }}
.stamp-blue {{ border: 4px solid #0284c7; color: #0284c7; background: rgba(224, 242, 254, 0.45); }}
/* NEW 2C: Fullscreen Cinema B-Roll */
.scene-broll-full {{ position: absolute; inset: 0; width: 1920px; height: 1080px; overflow: hidden; justify-content: center; align-items: center; }}
.broll-full-img {{ position: absolute; inset: 0; width: 1920px; height: 1080px; object-fit: cover; display: block; }}
.broll-video-overlay {{ position: absolute; inset: 0; width: 1920px; height: 1080px; object-fit: cover; z-index: 4; pointer-events: none; }}
.broll-vignette {{
position: absolute; inset: 0; pointer-events: none;
background: radial-gradient(ellipse 80% 75% at 50% 45%, rgba(0,0,0,0.06) 0%, rgba(0,0,0,0.52) 100%),
linear-gradient(180deg, rgba(0,0,0,0.38) 0%, rgba(0,0,0,0) 24%, rgba(0,0,0,0) 68%, rgba(0,0,0,0.78) 100%);
}}
.broll-atmos-title-wrap {{ position: relative; z-index: 6; display: flex; flex-direction: column; align-items: center; gap: 16px; max-width: 1400px; text-align: center; padding: 0 64px; }}
.broll-kicker {{ font-size: 20px; font-weight: 800; letter-spacing: 0.2em; color: #38bdf8; }}
.broll-atmos-title {{ font-size: 64px; font-weight: 900; color: #ffffff; text-shadow: 0 4px 28px rgba(0,0,0,0.85); line-height: 1.25; }}
/* NEW v4.3: DeepFactLab Depth Cross-Section & Sonar Fact-Check Map */
.scene-depth-cross {{ width: 100%; max-width: 1640px; justify-content: center; align-items: stretch; }}
.df-sticker-stack {{ position: absolute; top: 6px; left: 18px; z-index: 14; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }}
.df-yellow-sticker {{
padding: 10px 24px; border-radius: 8px; background: #facc15; color: #111827;
font-size: 28px; font-weight: 900; letter-spacing: -0.02em; transform: rotate(-1.6deg);
box-shadow: 0 10px 26px rgba(0, 0, 0, 0.48);
}}
.df-yellow-sticker.df-sticker-sm {{ font-size: 20px; padding: 6px 18px; background: #fde047; }}
.df-cross-stage {{ position: relative; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 28px; margin-top: 26px; }}
.df-cross-svg {{ width: 1000px; height: 470px; border-radius: 22px; border: 1.5px solid rgba(148, 163, 184, 0.22); background: rgba(7, 22, 32, 0.78); flex-shrink: 0; }}
.df-evidence-card {{
flex: 1; position: relative; padding: 38px 34px 30px 34px; border-radius: 18px;
background: rgba(15, 29, 38, 0.94); border: 1.5px solid rgba(148, 163, 184, 0.30);
box-shadow: 0 24px 56px rgba(0, 0, 0, 0.55); display: flex; flex-direction: column; gap: 18px;
}}
.df-ev-tab {{
position: absolute; top: -18px; left: 26px; padding: 6px 16px; border-radius: 6px;
background: #facc15; color: #0f172a; font-size: 16px; font-weight: 900;
}}
.df-ev-quote {{ position: relative; font-size: 31px; font-weight: 800; line-height: 1.42; color: #f8fafc; padding-bottom: 10px; }}
.df-qmark {{ color: #facc15; font-size: 42px; font-weight: 900; margin-right: 6px; }}
.df-yellow-underline {{ display: block; height: 6px; width: 78%; margin-top: 10px; border-radius: 99px; background: #facc15; transform-origin: left center; }}
.df-ev-source {{ font-size: 17px; font-weight: 600; color: #94a3b8; }}
.scene-sonar-map {{ flex-direction: row; justify-content: space-between; align-items: center; gap: 42px; max-width: 1620px; }}
.df-sonar-box, .df-photo-map-box {{
position: relative; width: 880px; height: 500px; border-radius: 22px;
background: rgba(8, 18, 28, 0.90); border: 1.5px solid rgba(148, 163, 184, 0.28);
overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}}
.df-sonar-svg, .df-photo-overlay-svg {{ width: 100%; height: 100%; display: block; }}
.df-photo-bg {{ position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(0.88) contrast(1.06); }}
.df-photo-overlay-svg {{ position: relative; z-index: 4; }}
.df-sonar-right {{ flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }}
.df-verdict-pill {{ padding: 8px 20px; border-radius: 999px; font-size: 18px; font-weight: 900; letter-spacing: 0.03em; }}
.verdict-false {{ background: rgba(244, 63, 94, 0.20); color: #fda4af; border: 1.5px solid #f43f5e; }}
.verdict-true {{ background: rgba(16, 185, 129, 0.20); color: #6ee7b7; border: 1.5px solid #10b981; }}
.df-sonar-title {{ font-size: 40px; font-weight: 900; color: #ffffff; letter-spacing: -0.03em; line-height: 1.24; }}
.df-zone-list {{ width: 100%; display: flex; flex-direction: column; gap: 12px; }}
.df-zone-item {{
display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-radius: 14px;
background: rgba(15, 29, 39, 0.88); border: 1px solid rgba(148, 163, 184, 0.24);
font-size: 21px; font-weight: 700; color: #f1f5f9;
}}
.df-zone-num {{
width: 30px; height: 30px; border-radius: 50%; background: #facc15; color: #0f172a;
display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 900; flex-shrink: 0;
}}
.df-source-pill {{ padding: 6px 14px; border-radius: 8px; background: rgba(9, 16, 22, 0.82); font-size: 15px; font-weight: 700; color: #cbd5e1; }}
/* NEW v4.0: Archify / Anatomy / Anime.js / Custom Visualization Stages */
.scene-archify, .scene-anime-chart, .scene-custom-viz {{ width: 100%; max-width: 1580px; align-items: stretch; gap: 20px; }}
.arch-head-bar, .chart-top-head {{ display: flex; align-items: center; gap: 20px; }}
.arch-main-title {{ font-size: 42px; font-weight: 900; color: var(--text-primary); letter-spacing: -0.03em; }}
.arch-svg-card {{
width: 100%; height: 480px; border-radius: 22px; background: rgba(7, 12, 24, 0.88);
border: 1.5px solid var(--border-subtle); padding: 10px 18px; display: flex; align-items: center; justify-content: center;
}}
.arch-svg {{ width: 100%; height: 100%; display: block; }}
.scene-anatomy {{ flex-direction: row; justify-content: space-between; align-items: center; gap: 44px; max-width: 1600px; }}
.anat-left-fig {{
width: 860px; height: 540px; border-radius: 22px; background: rgba(7, 13, 28, 0.92);
border: 1.5px solid rgba(56, 189, 248, 0.35); padding: 20px 24px; display: flex; flex-direction: column; justify-content: space-between; flex-shrink: 0;
}}
.anat-fig-header {{ display: flex; justify-content: space-between; align-items: center; font-family: monospace; font-size: 14px; font-weight: 800; color: #7dd3fc; }}
.anat-fig-live {{ color: #34d399; }}
.anat-svg {{ width: 100%; height: 460px; display: block; }}
.anat-right-col {{ flex: 1; display: flex; flex-direction: column; gap: 20px; }}
.anat-title {{ font-size: 40px; font-weight: 900; color: var(--text-primary); letter-spacing: -0.03em; line-height: 1.2; }}
.anat-spec-list {{ display: flex; flex-direction: column; gap: 14px; }}
.anat-spec-row {{
display: flex; align-items: center; gap: 18px; padding: 16px 22px; border-radius: 16px;
background: var(--bg-card); border: 1px solid var(--border-subtle);
}}
.anat-step-idx {{ font-family: monospace; font-size: 22px; font-weight: 900; color: var(--accent); flex-shrink: 0; }}
.anat-step-head {{ font-size: 23px; font-weight: 800; color: var(--text-primary); }}
.anat-step-desc {{ font-size: 17px; font-weight: 500; color: var(--text-secondary); margin-top: 2px; }}
.chart-body-row {{ display: flex; gap: 28px; align-items: stretch; height: 470px; }}
.chart-svg-panel {{
flex: 1; border-radius: 22px; background: rgba(8, 14, 28, 0.90); border: 1.5px solid var(--border-subtle);
padding: 18px 22px; display: flex; align-items: center; justify-content: center;
}}
.anime-chart-svg {{ width: 100%; height: 100%; display: block; }}
.chart-gauges-col {{ width: 440px; display: flex; flex-direction: column; justify-content: space-between; gap: 16px; flex-shrink: 0; }}
.svg-gauge-card {{
flex: 1; border-radius: 18px; background: var(--bg-card); border: 1px solid var(--border-subtle);
padding: 14px 20px; display: flex; align-items: center; gap: 18px;
}}
.gauge-ring-svg {{ width: 84px; height: 84px; flex-shrink: 0; }}
.gauge-label {{ font-size: 22px; font-weight: 800; color: var(--text-primary); }}
.gauge-sub {{ font-size: 16px; font-weight: 500; color: var(--text-secondary); margin-top: 4px; }}
.custom-viz-frame {{
width: 100%; height: 500px; border-radius: 22px; background: rgba(7, 12, 24, 0.92);
border: 2px solid var(--accent-strong); overflow: hidden; display: flex; align-items: center; justify-content: center;
}}
.custom-viz-iframe {{ width: 100%; height: 100%; border: 0; display: block; background: transparent; }}
.custom-svg-host {{ width: 100%; height: 100%; padding: 18px; display: flex; align-items: center; justify-content: center; }}
.custom-svg-host svg {{ max-width: 100%; max-height: 100%; width: auto; height: auto; }}
/* NEW 3: Vertical Changelog */
.scene-changelog {{ align-items: flex-start; justify-content: center; max-width: 1580px; }}
.clog-header {{ font-size: 52px; font-weight: 900; color: var(--text-primary); letter-spacing: -0.03em; align-self: flex-start; }}
.clog-body {{ position: relative; width: 100%; padding-left: 10px; margin-top: 10px; }}
.clog-spine {{ position: absolute; left: 168px; top: 18px; bottom: 18px; width: 3px; background: rgba(96, 165, 250, 0.45); transform-origin: top center; }}
.clog-rows-wrap {{ display: flex; flex-direction: column; gap: 20px; }}
.clog-row {{ display: flex; align-items: center; gap: 28px; padding: 14px 24px; border-radius: 16px; background: rgba(12, 19, 36, 0.76); border: 1px solid var(--border-subtle); }}
.clog-date {{ width: 118px; font-size: 28px; font-weight: 900; font-family: monospace; flex-shrink: 0; }}
.clog-dot-wrap {{ width: 26px; display: flex; justify-content: center; flex-shrink: 0; }}
.clog-dot {{ display: block; width: 16px; height: 16px; border-radius: 50%; }}
.clog-ver {{ width: 120px; font-size: 21px; font-weight: 700; color: #cbd5e1; font-family: monospace; flex-shrink: 0; }}
.clog-desc {{ font-size: 29px; font-weight: 800; color: #f8fafc; }}
/* NEW 4: Mission Staircase */
.scene-staircase {{ align-items: flex-start; max-width: 1640px; }}
.staircase-layout {{ width: 100%; display: flex; align-items: flex-end; justify-content: space-between; gap: 44px; }}
.mission-list-col {{ flex: 1; display: flex; flex-direction: column; gap: 16px; max-width: 940px; }}
.mission-row {{ display: flex; align-items: center; gap: 22px; padding: 16px 24px; border-radius: 14px; background: var(--bg-card); border: 1px solid var(--border-subtle); }}
.mission-bar {{ display: block; width: 7px; height: 44px; border-radius: 4px; flex-shrink: 0; }}
.mission-tag {{ width: 145px; font-size: 23px; font-weight: 900; letter-spacing: 0.04em; flex-shrink: 0; }}
.mission-head {{ width: 250px; font-size: 31px; font-weight: 800; color: var(--text-primary); flex-shrink: 0; }}
.mission-sub {{ font-size: 22px; font-weight: 600; color: var(--text-secondary); }}
.stair-3d-stage {{ width: 620px; height: 470px; display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; padding-bottom: 8px; }}
.stair-col {{ flex: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; }}
.stair-top-label {{ font-size: 13px; font-weight: 800; color: #94a3b8; }}
.stair-cube {{ width: 100%; border-radius: 10px 10px 4px 4px; border: 1.5px solid #38bdf8; box-shadow: 0 18px 36px rgba(0,0,0,0.45); transform-origin: bottom center; }}
/* NEW 5: /swarm Hub-and-Spoke Network */
.scene-swarm {{ flex-direction: row; justify-content: space-between; align-items: center; gap: 40px; }}
.swarm-left {{ width: 640px; display: flex; flex-direction: column; gap: 20px; }}
.swarm-big-cmd {{ font-size: 96px; font-weight: 900; color: #fde047; text-shadow: 0 0 36px rgba(250, 204, 21, 0.35); font-family: monospace; }}
.swarm-title {{ font-size: 46px; font-weight: 900; color: var(--text-primary); line-height: 1.25; }}
.swarm-sub {{ font-size: 24px; font-weight: 600; color: var(--text-secondary); line-height: 1.5; }}
.swarm-graph-box {{ position: relative; width: 980px; height: 520px; flex-shrink: 0; }}
.swarm-svg {{ position: absolute; inset: 0; width: 100%; height: 100%; }}
.swarm-hub-core {{
position: absolute; left: 395px; top: 175px; width: 190px; height: 120px; border-radius: 24px;
background: rgba(120, 53, 15, 0.90); border: 2.5px solid #fbbf24; box-shadow: 0 0 42px rgba(251, 191, 36, 0.38);
display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; z-index: 5;
}}
.hub-tag {{ font-size: 14px; font-weight: 900; letter-spacing: 0.08em; color: #fde68a; }}
.hub-name {{ font-size: 26px; font-weight: 900; color: #ffffff; }}
.swarm-node {{
position: absolute; width: 215px; padding: 14px 18px; border-radius: 18px;
background: rgba(12, 20, 38, 0.94); border: 2px solid #38bdf8;
display: flex; align-items: center; gap: 12px; z-index: 5;
}}
.swarm-orb {{ width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; }}
.swarm-node-id {{ font-size: 19px; font-weight: 800; color: #f8fafc; }}
.swarm-node-role {{ font-size: 15px; font-weight: 600; color: #cbd5e1; }}
/* NEW 6: Pricing / Feature Matrix */
.scene-pricing {{ align-items: flex-start; max-width: 1560px; }}
.pm-table {{ width: 100%; display: flex; flex-direction: column; gap: 14px; }}
.pm-head-row {{ display: grid; grid-template-columns: 2.1fr 1fr 1fr 1fr; gap: 18px; align-items: stretch; }}
.pm-feat-spacer {{ padding: 18px 24px; font-size: 20px; font-weight: 800; color: var(--text-secondary); display: flex; align-items: center; }}
.pm-plan-head {{ padding: 16px 20px; border-radius: 16px; background: var(--bg-card-active); border: 2px solid var(--accent); text-align: center; display: flex; flex-direction: column; gap: 4px; }}
.pm-plan-tier {{ font-size: 17px; font-weight: 800; }}
.pm-plan-price {{ font-size: 26px; font-weight: 900; color: var(--text-primary); }}
.pm-row {{ display: grid; grid-template-columns: 2.1fr 1fr 1fr 1fr; gap: 18px; align-items: center; padding: 16px 24px; border-radius: 14px; background: var(--bg-card); border: 1px solid var(--border-subtle); }}
.pm-feat {{ font-size: 25px; font-weight: 800; color: var(--text-primary); }}
.pm-cell {{ text-align: center; font-size: 26px; font-weight: 900; }}
.sym-ok {{ color: #34d399; }}
.sym-no {{ color: #fb7185; }}
.sym-warn {{ color: #fbbf24; }}
.pm-sym-txt {{ font-size: 21px; font-weight: 700; color: var(--text-secondary); }}
/* Existing v2.0 Archetypes */
.hero-stat-row {{ display: flex; align-items: baseline; justify-content: center; gap: 18px; }}
.stat-prefix, .stat-suffix {{ font-size: 56px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.03em; }}
.stat-big-num {{ font-size: 128px; font-weight: 900; line-height: 1; color: var(--accent); letter-spacing: -0.04em; }}
.arc-stage {{ width: 100%; max-width: 1680px; height: 310px; display: flex; align-items: center; justify-content: center; gap: 14px; }}
.arc-slot {{ flex: 0 0 168px; height: 252px; display: flex; }}
.arc-card {{ width: 100%; height: 100%; padding: 18px 14px; border-radius: 20px; background: var(--bg-card); border: 1.5px solid var(--border-subtle); display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; }}
.arc-avatar {{ width: 62px; height: 62px; border-radius: 50%; background: var(--bg-card-active); border: 2px solid var(--accent); display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 800; color: var(--text-primary); }}
.arc-name {{ font-size: 21px; font-weight: 800; color: var(--text-primary); }}
.arc-desc {{ font-size: 15px; font-weight: 500; color: var(--text-secondary); }}
.arc-status {{ padding: 4px 12px; border-radius: 999px; background: var(--bg-card-active); border: 1px solid var(--accent); display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; color: var(--accent); }}
.status-dot {{ display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }}
.scene-split {{ flex-direction: row; gap: 50px; max-width: 1480px; }}
.mock-phone-panel {{ width: 430px; height: 530px; border-radius: 28px; background: var(--bg-card); border: 1.5px solid var(--border-subtle); overflow: hidden; display: flex; flex-direction: column; }}
.mock-header {{ padding: 22px 26px; background: var(--bg-card-active); border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; gap: 12px; }}
.mock-blue-dot {{ display: block; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); }}
.mock-header-title {{ font-size: 21px; font-weight: 800; color: var(--text-primary); }}
.mock-body {{ padding: 22px; display: flex; flex-direction: column; gap: 16px; }}
.mock-chat-row {{ padding: 15px 16px; border-radius: 16px; background: var(--bg-card-active); border: 1px solid var(--border-subtle); display: flex; align-items: center; gap: 14px; }}
.mock-avatar {{ width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--accent); display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 800; color: var(--text-primary); flex-shrink: 0; }}
.mock-lines {{ flex: 1; display: flex; flex-direction: column; gap: 8px; }}
.mock-line-title {{ font-size: 17px; font-weight: 700; color: var(--text-primary); }}
.mock-bar-track {{ width: 100%; height: 7px; border-radius: 99px; background: var(--border-subtle); overflow: hidden; }}
.mock-bar-fill {{ height: 100%; border-radius: 99px; background: var(--accent); }}
.mock-badge {{ padding: 4px 11px; border-radius: 999px; background: var(--accent); font-size: 14px; font-weight: 800; color: var(--pill-ink); }}
.steps-col {{ flex: 1; display: flex; flex-direction: column; gap: 20px; }}
.step-card {{ width: 100%; min-height: 152px; padding: 26px 32px; border-radius: 22px; background: var(--bg-card); border: 2px solid var(--border-subtle); display: flex; align-items: center; gap: 24px; }}
.step-icon-ring {{ width: 70px; height: 70px; border-radius: 50%; background: var(--bg-card-active); border: 2px solid var(--accent); display: flex; align-items: center; justify-content: center; font-size: 23px; font-weight: 800; color: var(--accent); flex-shrink: 0; }}
.step-text-col {{ display: flex; flex-direction: column; gap: 6px; }}
.step-head {{ font-size: 32px; font-weight: 800; color: var(--text-primary); }}
.step-sub {{ font-size: 21px; font-weight: 500; color: var(--text-secondary); }}
.book-hardcover-shell {{ padding: 12px 16px 18px 16px; border-radius: 20px; background: #1e293b; box-shadow: 0 34px 76px rgba(0,0,0,0.52), inset 0 -6px 0 #cbd5e1; }}
.book-spread {{ width: 1180px; height: 515px; border-radius: 12px; background: #f8fafc; display: flex; overflow: hidden; }}
.book-page {{ flex: 1; padding: 42px 46px; background: #fbfaf8; color: #0f172a; display: flex; flex-direction: column; justify-content: space-between; position: relative; transform-origin: left center; }}
.book-spine {{ width: 8px; background: linear-gradient(90deg, #cbd5e1, #64748b, #cbd5e1); }}
.book-ribbon {{ position: absolute; top: 0; right: 42px; width: 22px; height: 58px; background: #e11d48; border-radius: 0 0 4px 4px; }}
.book-kicker {{ font-size: 14px; font-weight: 800; letter-spacing: 0.08em; color: #0369a1; }}
.book-left-title {{ font-size: 31px; font-weight: 800; line-height: 1.32; color: #0f172a; }}
.book-para {{ font-size: 20px; font-weight: 500; line-height: 1.6; color: #1e293b; }}
.book-quote-box {{ position: relative; padding: 22px 24px; border-radius: 14px; background: #e0f2fe; border-left: 5px solid #0284c7; overflow: hidden; }}
.book-hl-bar {{ position: absolute; inset: 0; background: rgba(56, 189, 248, 0.35); transform-origin: left center; }}
.book-quote-text {{ position: relative; font-size: 23px; font-weight: 800; line-height: 1.48; color: #0c4a6e; }}
.book-page-num {{ font-size: 14px; font-weight: 700; color: #475569; }}
.book-page-num.right {{ text-align: right; }}
.nb-shell {{ position: relative; width: 1240px; height: 550px; border-radius: 22px; background: #fefce8; box-shadow: 0 30px 70px rgba(0,0,0,0.45); display: flex; overflow: visible; border: 2px solid #e2e8f0; }}
.nb-tabs {{ position: absolute; right: -28px; top: 48px; display: flex; flex-direction: column; gap: 14px; }}
.nb-tab {{ display: flex; align-items: center; justify-content: center; width: 32px; height: 64px; border-radius: 0 10px 10px 0; font-size: 14px; font-weight: 800; color: #0f172a; }}
.tab-1 {{ background: #38bdf8; }} .tab-2 {{ background: #fbbf24; }} .tab-3 {{ background: #34d399; }}
.nb-page {{ flex: 1; padding: 40px 44px; background: #fffdf7; color: #0f172a; display: flex; flex-direction: column; justify-content: space-between; border-radius: 20px; }}
.nb-rings-col {{ width: 34px; background: #e2e8f0; display: flex; flex-direction: column; align-items: center; justify-content: space-evenly; padding: 24px 0; }}
.nb-ring {{ display: block; width: 28px; height: 14px; border-radius: 99px; background: #475569; border: 2px solid #94a3b8; }}
.nb-tag {{ font-size: 14px; font-weight: 800; letter-spacing: 0.08em; color: #0369a1; }}
.nb-main-title {{ font-size: 34px; font-weight: 800; line-height: 1.3; color: #0f172a; }}
.nb-callout {{ padding: 24px; border-radius: 16px; background: #fef3c7; border-left: 5px solid #d97706; display: flex; flex-direction: column; gap: 8px; }}
.nb-callout-head {{ font-size: 16px; font-weight: 800; color: #92400e; }}
.nb-callout-body {{ font-size: 21px; font-weight: 700; line-height: 1.48; color: #451a03; }}
.nb-foot {{ font-size: 14px; font-weight: 800; color: #475569; }}
.nb-checklist {{ display: flex; flex-direction: column; gap: 16px; flex: 1; justify-content: center; }}
.nb-check-row {{ padding: 14px 18px; border-radius: 14px; background: #f8fafc; border: 1.5px solid #cbd5e1; display: flex; align-items: center; gap: 16px; }}
.nb-check-box {{ width: 34px; height: 34px; border-radius: 10px; background: #0284c7; color: #ffffff; display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 900; flex-shrink: 0; }}
.nb-check-title {{ font-size: 21px; font-weight: 800; color: #0f172a; }}
.nb-check-desc {{ font-size: 16px; font-weight: 500; color: #334155; }}
.bento-grid-12 {{ width: 1420px; display: grid; grid-template-columns: repeat(12, 1fr); gap: 22px; }}
.bento-tile {{ padding: 30px 34px; border-radius: 24px; background: var(--bg-card); border: 1.5px solid var(--border-subtle); display: flex; flex-direction: column; justify-content: center; gap: 12px; min-height: 245px; }}
.bento-hero {{ background: var(--bg-card-active); border-color: var(--accent-strong); }}
.bento-span-7 {{ grid-column: span 7; }} .bento-span-5 {{ grid-column: span 5; }} .bento-span-6 {{ grid-column: span 6; }}
.bento-kicker {{ font-size: 15px; font-weight: 800; letter-spacing: 0.08em; color: var(--accent); }}
.bento-hero-title {{ font-size: 40px; font-weight: 900; line-height: 1.22; color: var(--text-primary); }}
.bento-hero-sub {{ font-size: 21px; font-weight: 600; color: var(--text-secondary); }}
.bento-num-pill {{ align-self: flex-start; padding: 4px 14px; border-radius: 999px; background: var(--accent); color: var(--pill-ink); font-size: 15px; font-weight: 900; }}
.bento-tile-title {{ font-size: 29px; font-weight: 800; color: var(--text-primary); }}
.bento-tile-desc {{ font-size: 20px; font-weight: 500; color: var(--text-secondary); line-height: 1.45; }}
.vs-stage {{ width: 1440px; display: flex; align-items: stretch; justify-content: space-between; gap: 26px; }}
.vs-card {{ flex: 1; padding: 36px 38px; border-radius: 26px; background: var(--bg-card); border: 2px solid var(--border-subtle); display: flex; flex-direction: column; gap: 20px; }}
.vs-tobe {{ background: var(--bg-card-active); border-color: var(--accent); }}
.vs-center-orb {{ align-self: center; width: 78px; height: 78px; border-radius: 50%; background: var(--accent); color: var(--pill-ink); display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 900; flex-shrink: 0; }}
.vs-tag {{ align-self: flex-start; padding: 6px 16px; border-radius: 999px; font-size: 15px; font-weight: 800; }}
.asis-tag {{ background: rgba(244, 63, 94, 0.18); color: {'#be123c' if is_light else '#fda4af'}; border: 1px solid rgba(244, 63, 94, 0.45); }}
.tobe-tag {{ background: var(--accent); color: var(--pill-ink); }}
.vs-card-title {{ font-size: 32px; font-weight: 800; color: var(--text-primary); }}
.vs-list {{ display: flex; flex-direction: column; gap: 16px; }}
.vs-row {{ display: flex; align-items: center; gap: 14px; font-size: 22px; font-weight: 600; color: var(--text-primary); line-height: 1.4; }}
.vs-mark {{ width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 900; flex-shrink: 0; }}
.vs-minus {{ background: rgba(244, 63, 94, 0.2); color: {'#be123c' if is_light else '#fda4af'}; }}
.vs-plus {{ background: var(--accent); color: var(--pill-ink); }}
.bars-stack {{ width: 1320px; display: flex; flex-direction: column; gap: 18px; }}
.bar-row-card {{ padding: 20px 28px; border-radius: 20px; background: var(--bg-card); border: 1.5px solid var(--border-subtle); display: flex; flex-direction: column; gap: 12px; }}
.bar-label-row {{ display: flex; align-items: center; justify-content: space-between; gap: 20px; }}
.bar-title-group {{ display: flex; align-items: baseline; gap: 14px; }}
.bar-idx {{ font-size: 18px; font-weight: 800; color: var(--accent); }}
.bar-head {{ font-size: 26px; font-weight: 800; color: var(--text-primary); }}
.bar-desc {{ font-size: 19px; font-weight: 500; color: var(--text-secondary); }}
.bar-val-badge {{ padding: 6px 18px; border-radius: 999px; background: var(--accent); color: var(--pill-ink); font-size: 22px; font-weight: 900; }}
.bar-track {{ width: 100%; height: 14px; border-radius: 99px; background: var(--border-subtle); overflow: hidden; }}
.bar-fill {{ display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent-strong), var(--accent)); transform-origin: left center; }}
.tl-track-wrap {{ position: relative; width: 1520px; padding-top: 24px; }}
.tl-rail-bg {{ position: absolute; top: 72px; left: 120px; right: 120px; height: 4px; background: var(--border-subtle); border-radius: 99px; overflow: hidden; }}
.tl-rail-beam {{ display: block; width: 100%; height: 100%; background: var(--accent); transform-origin: left center; }}
.tl-cards-row {{ position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }}
.tl-step-card {{ padding: 28px 24px; border-radius: 24px; background: var(--bg-card); border: 1.5px solid var(--border-subtle); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; min-height: 290px; }}
.tl-step-circle {{ width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: var(--pill-ink); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 900; }}
.tl-step-title {{ font-size: 27px; font-weight: 800; color: var(--text-primary); }}
.tl-step-desc {{ font-size: 19px; font-weight: 500; color: var(--text-secondary); line-height: 1.45; }}
.term-badges-row {{ display: flex; gap: 16px; }}
.terminal-window {{ width: 1180px; border-radius: 22px; background: #090f1d; border: 1.5px solid var(--accent-strong); overflow: hidden; }}
.term-titlebar {{ padding: 15px 24px; background: #131f3a; border-bottom: 1px solid rgba(148,163,184,0.2); display: flex; align-items: center; gap: 16px; }}
.term-dots {{ display: flex; gap: 8px; }}
.tdot {{ display: block; width: 12px; height: 12px; border-radius: 50%; background: #60a5fa; }}
.term-title {{ font-size: 18px; font-weight: 700; color: #e2e8f0; }}
.term-content {{ padding: 28px 32px; display: flex; flex-direction: column; gap: 16px; }}
.term-prompt-row {{ display: flex; align-items: center; gap: 14px; font-family: monospace; font-size: 24px; font-weight: 700; }}
.term-chevron {{ color: #38bdf8; }}
.term-cmd-reveal {{ display: inline-block; overflow: hidden; white-space: nowrap; }}
.term-cmd-text {{ color: #f8fafc; }}
.term-caret {{ display: inline-block; width: 12px; height: 26px; background: #38bdf8; }}
.term-log-line {{ font-size: 19px; font-weight: 600; color: #7dd3fc; }}
.flow-nodes-row {{ width: 1180px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }}
.flow-node {{ width: 470px; padding: 24px 30px; border-radius: 22px; background: var(--bg-card); border: 2px solid var(--border-subtle); display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }}
.flow-node.active-node {{ border-color: var(--accent); }}
.flow-node-tag {{ font-size: 14px; font-weight: 800; letter-spacing: 0.1em; color: var(--accent); }}
.flow-node-title {{ font-size: 30px; font-weight: 800; color: var(--text-primary); }}
.flow-node-sub {{ font-size: 18px; font-weight: 500; color: var(--text-secondary); }}
.flow-connector {{ flex: 1; height: 30px; position: relative; display: flex; align-items: center; }}
.flow-line {{ width: 100%; height: 3px; background: var(--border-subtle); border-radius: 99px; }}
.flow-pulse-dot {{ position: absolute; left: 0; top: 7px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); }}
.pillars-grid {{ width: 1320px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }}
.pillar-card {{ height: 396px; padding: 36px 28px; border-radius: 26px; background: var(--bg-card); border: 2px solid var(--accent-strong); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; text-align: center; }}
.pillar-num {{ font-size: 23px; font-weight: 800; color: var(--accent); }}
.pillar-ring {{ width: 80px; height: 80px; border-radius: 50%; background: var(--bg-card-active); border: 2px solid var(--accent); display: flex; align-items: center; justify-content: center; }}
.pillar-ring-dot {{ display: block; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); }}
.pillar-title {{ font-size: 34px; font-weight: 800; color: var(--text-primary); }}
.pillar-desc {{ font-size: 20px; font-weight: 500; color: var(--text-secondary); line-height: 1.45; }}
.pillars-footer {{ padding: 14px 28px; border-radius: 999px; background: var(--bg-card-active); border: 1.5px solid var(--accent); display: inline-flex; align-items: center; gap: 12px; font-size: 23px; font-weight: 700; color: var(--text-primary); }}
/* 6 Caption Styles */
.caption-slot {{ position: absolute; left: 96px; right: 96px; bottom: 26px; height: 128px; display: flex; align-items: center; justify-content: center; z-index: 30; pointer-events: none; }}
.caption-box {{ padding: 14px 32px; border-radius: 18px; background: var(--cap-bg); border: 1px solid rgba(148, 163, 184, 0.2); display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; max-width: 1560px; }}
.caption-box.style-briefing {{ width: 1540px; border-radius: 12px; background: rgba(3, 6, 14, 0.90); border: 1px solid rgba(56, 189, 248, 0.14); padding: 15px 36px; }}
.briefing-ko {{ font-size: 36px; font-weight: 700; }}
.caption-box.style-cinema {{ background: {cinema_bg}; border: none; border-radius: 8px; padding: 10px 28px; }}
.caption-box.style-yellow-bar {{ background: rgba(9, 14, 19, 0.84); border: 1px solid rgba(148, 163, 184, 0.16); border-radius: 8px; padding: 11px 28px; }}
.df-cap-row {{ display: flex; align-items: center; gap: 16px; }}
.df-cap-bar {{ display: inline-block; width: 4px; height: 36px; border-radius: 3px; background: #facc15; flex-shrink: 0; }}
.df-cap-ko {{ font-size: 37px; font-weight: 800; }}
.caption-box.style-neon-bar {{ align-items: flex-start; text-align: left; border-radius: 6px 18px 18px 6px; border-left: 6px solid var(--accent); padding: 14px 34px; }}
.neon-bar-kicker {{ font-size: 14px; font-weight: 800; letter-spacing: 0.08em; color: #7dd3fc; }}
.cap-ko {{ font-size: 39px; font-weight: 800; color: #ffffff; letter-spacing: -0.02em; line-height: 1.25; text-shadow: 0 2px 14px rgba(0,0,0,0.88); }}
.cap-en {{ font-size: 22px; font-weight: 600; color: #cbd5e1; line-height: 1.25; }}
.kara-line {{ display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 10px; align-items: center; }}
.kara-br {{ flex-basis: 100%; height: 0; }}
.kara-word {{ display: inline-block; padding: 3px 11px; border-radius: 11px; font-size: 38px; font-weight: 800; color: #ffffff; }}
.kin-accent {{ color: #7dd3fc; }}
</style>
</head>
<body>
<div
id="root"
data-composition-id="main"
data-start="0"
data-duration="{total_dur}"
data-width="1920"
data-height="1080"
>
<div class="bg-atmosphere" data-layout-ignore></div>
<canvas id="wave-canvas" width="1920" height="1080" data-layout-allow-overflow data-layout-ignore></canvas>
{hud_markup}
{"".join(scenes_html)}
{"".join(video_overlays_html)}
{"".join(captions_html)}
{"".join(vo_audio_html)}
{"".join(sfx_audio_html)}
{bgm_html}
</div>
<script>
const CHOREO = {choreo_json};
const waveCanvas = document.getElementById("wave-canvas");
const wCtx = waveCanvas.getContext("2d");
const SCRAMBLE_GLYPHS = "가나다라마바사아자차카타파하0123456789ABCDEF#%&*";
{CANVAS_RENDERERS_JS}
function resolveSlidePresetAt(tSec) {{
for (var i = 0; i < CHOREO.slides.length; i++) {{
var s = CHOREO.slides[i];
if (tSec >= s.start && tSec < s.end) return s.bgPreset;
}}
return CHOREO.slides.length ? CHOREO.slides[CHOREO.slides.length - 1].bgPreset : "horizon_wave";
}}
const tl = gsap.timeline({{ paused: true }});
// Deterministic Seek Bridge: Drives any Anime.js timeline from GSAP's main seekable timeline!
function bindAnimeToMainTimeline(animeTl, startSec, durSec) {{
if (!animeTl || !animeTl.duration) return;
var proxy = {{ p: 0 }};
animeTl.seek(0);
tl.fromTo(
proxy,
{{ p: 0 }},
{{
p: 1,
duration: Math.max(0.4, durSec),
ease: "none",
onUpdate: function () {{
animeTl.seek(proxy.p * animeTl.duration);
}},
}},
startSec
);
}}
const waveProxy = {{ t: 0 }};
drawBackgroundPreset(wCtx, resolveSlidePresetAt(0), 0);
tl.to(
waveProxy,
{{
t: CHOREO.totalDuration,
duration: CHOREO.totalDuration,
ease: "none",
onUpdate: function () {{
drawBackgroundPreset(wCtx, resolveSlidePresetAt(waveProxy.t), waveProxy.t);
var bCur = document.getElementById("briefing-cursor");
if (bCur) {{
bCur.style.opacity = Math.floor(waveProxy.t * 2.2) % 2 === 0 ? "1" : "0.15";
}}
var dfCtx = document.getElementById("deepfact-ctx-text");
if (dfCtx) {{
for (var si = 0; si < CHOREO.slides.length; si++) {{
var sl = CHOREO.slides[si];
if (waveProxy.t >= sl.start && waveProxy.t < sl.end) {{
if (dfCtx.textContent !== sl.contextBadge) dfCtx.textContent = sl.contextBadge;
break;
}}
}}
}}
}},
}},
0
);
for (let ci = 0; ci < CHOREO.chaptersCount; ci++) {{
gsap.set("#chap-fill-" + ci, {{ scaleX: 0 }});
}}
if (document.getElementById("docu-prog-fill")) {{
tl.fromTo("#docu-prog-fill", {{ scaleX: 0.02 }}, {{ scaleX: 1.0, duration: CHOREO.totalDuration, ease: "none" }}, 0);
}}
// Deterministic Text Scramble Decode Animations
CHOREO.scrambles.forEach(function (sc) {{
var el = document.getElementById(sc.id);
if (!el) return;
var target = sc.text;
var proxy = {{ p: 0 }};
tl.fromTo(
proxy,
{{ p: 0 }},
{{
p: 1,
duration: 0.85,
ease: "power2.out",
onUpdate: function () {{
var revealLen = Math.floor(proxy.p * target.length);
var out = "";
for (var i = 0; i < target.length; i++) {{
if (target[i] === " ") {{
out += " ";
}} else if (i < revealLen || proxy.p >= 0.99) {{
out += target[i];
}} else {{
var gIdx = Math.floor(pseudoRand(i * 19 + Math.floor(proxy.p * 24)) * SCRAMBLE_GLYPHS.length);
out += SCRAMBLE_GLYPHS[gIdx];
}}
}}
el.textContent = out;
}},
}},
sc.start
);
}});
CHOREO.slides.forEach(function (s, idx) {{
const sid = "s" + (idx + 1);
const st = s.start;
const dur = s.duration;
const ci = s.chapterIndex;
if (ci < CHOREO.chaptersCount) {{
tl.fromTo("#chap-tab-" + ci, {{ backgroundColor: CHOREO.themeCardActive, borderColor: CHOREO.themeAccentStrong }}, {{ backgroundColor: CHOREO.themeCardActive, borderColor: CHOREO.themeAccentStrong, duration: Math.max(0.1, dur - 0.05), immediateRender: false }}, st);
tl.to("#chap-tab-" + ci, {{ backgroundColor: "rgba(0,0,0,0)", borderColor: "rgba(0,0,0,0)", duration: 0.04, immediateRender: false }}, st + dur - 0.04);
tl.fromTo("#chap-fill-" + ci, {{ scaleX: 0.05 }}, {{ scaleX: 1.0, duration: dur, ease: "none", immediateRender: false }}, st);
}}
tl.fromTo("#" + sid + "-inner", {{ opacity: 0, y: 22 }}, {{ opacity: 1, y: 0, duration: 0.40, ease: "power3.out" }}, st);
if (dur > 0.8) {{
tl.to("#" + sid + "-inner", {{ opacity: 0, y: -12, duration: 0.22, ease: "power2.in", immediateRender: false }}, st + dur - 0.23);
}}
if (s.archetype === "hero_3d_briefing") {{
tl.fromTo("#" + sid + "-big-title", {{ opacity: 0, scale: 0.90 }}, {{ opacity: 1, scale: 1.0, duration: 0.55, ease: "power3.out" }}, st + 0.08);
tl.fromTo("#" + sid + "-gold-sub", {{ opacity: 0, y: 18 }}, {{ opacity: 1, y: 0, duration: 0.45, ease: "power2.out" }}, st + 0.25);
const pCount = Math.min(7, Math.max(1, s.bulletsCount));
for (let k = 0; k < pCount; k++) {{
tl.fromTo("#" + sid + "-htag-" + k, {{ opacity: 0, y: 16, scale: 0.88 }}, {{ opacity: 1, y: 0, scale: 1.0, duration: 0.34, ease: "back.out(1.5)" }}, st + 0.36 + k * 0.06);
}}
}} else if (s.archetype === "media_showcase_split") {{
tl.fromTo("#" + sid + "-hero-kw", {{ opacity: 0, x: -30 }}, {{ opacity: 1, x: 0, duration: 0.45, ease: "power3.out" }}, st + 0.10);
tl.fromTo("#" + sid + "-media-frame", {{ opacity: 0, x: 36, scale: 0.96 }}, {{ opacity: 1, x: 0, scale: 1.0, duration: 0.52, ease: "power3.out" }}, st + 0.14);
}} else if (s.archetype === "dossier_stamp_card") {{
tl.fromTo("#" + sid + "-dos-shell", {{ opacity: 0, y: 30, scale: 0.95 }}, {{ opacity: 1, y: 0, scale: 1.0, duration: 0.48, ease: "power3.out" }}, st + 0.08);
const dRows = Math.min(4, Math.max(1, s.bulletsCount));
for (let k = 0; k < dRows; k++) {{
tl.fromTo("#" + sid + "-dos-row-" + k, {{ opacity: 0, x: -24 }}, {{ opacity: 1, x: 0, duration: 0.34, ease: "power2.out" }}, st + 0.22 + k * 0.16);
}}
const stampTime = st + 0.65;
tl.fromTo("#" + sid + "-dos-stamp", {{ opacity: 0, scale: 2.2, rotation: -18 }}, {{ opacity: 1, scale: 1.0, rotation: -8, duration: 0.34, ease: "back.out(2.0)" }}, stampTime);
}} else if (s.archetype === "depth_cross_section") {{
tl.fromTo("#" + sid + "-df-stick-1", {{ opacity: 0, x: -24 }}, {{ opacity: 1, x: 0, duration: 0.38, ease: "back.out(1.4)" }}, st + 0.08);
tl.fromTo("#" + sid + "-df-stick-2", {{ opacity: 0, x: -24 }}, {{ opacity: 1, x: 0, duration: 0.38, ease: "back.out(1.4)" }}, st + 0.18);
tl.fromTo("#" + sid + "-sub-mover", {{ attr: {{ transform: "translate(630, 118)" }} }}, {{ attr: {{ transform: "translate(645, 355)" }}, duration: Math.max(1.2, dur * 0.78), ease: "power1.inOut" }}, st + 0.12);
for (let k = 0; k < Math.min(4, Math.max(1, s.bulletsCount)); k++) {{
if (document.getElementById(sid + "-dmark-" + k)) {{
tl.fromTo("#" + sid + "-dmark-" + k, {{ opacity: 0 }}, {{ opacity: 1, duration: 0.35, ease: "power2.out" }}, st + 0.16 + k * 0.22);
}}
}}
tl.fromTo("#" + sid + "-df-quote-card", {{ opacity: 0, y: 24 }}, {{ opacity: 1, y: 0, duration: 0.46, ease: "power3.out" }}, st + 0.28);
const ulineTime = s.beats.length > 1 ? s.beats[1].start : st + 0.85;
tl.fromTo("#" + sid + "-df-uline", {{ scaleX: 0 }}, {{ scaleX: 1, duration: 0.65, ease: "power2.out" }}, Math.max(st + 0.45, ulineTime));
}} else if (s.archetype === "sonar_factcheck_map") {{
if (typeof anime !== "undefined") {{
var sonTl = anime.timeline({{ autoplay: false }});
sonTl.add({{
targets: "." + sid + "-sonar-path",
strokeDashoffset: [anime.setDashoffset, 0],
delay: anime.stagger(140),
duration: 850,
easing: "easeInOutSine",
}}).add({{
targets: "." + sid + "-df-zone",
opacity: [0, 1],
delay: anime.stagger(150),
duration: 420,
easing: "easeOutCubic",
}}, 120);
bindAnimeToMainTimeline(sonTl, st + 0.12, Math.min(2.1, dur * 0.62));
}}
for (let k = 0; k < Math.min(4, Math.max(1, s.bulletsCount)); k++) {{
if (document.getElementById(sid + "-sleg-" + k)) {{
tl.fromTo("#" + sid + "-sleg-" + k, {{ opacity: 0, x: 24 }}, {{ opacity: 1, x: 0, duration: 0.36, ease: "power2.out" }}, st + 0.22 + k * 0.18);
}}
}}
if (document.getElementById(sid + "-verdict-mark")) {{
tl.fromTo("#" + sid + "-verdict-mark", {{ opacity: 0, scale: 2.1, svgOrigin: "455 272" }}, {{ opacity: 1, scale: 1.0, svgOrigin: "455 272", duration: 0.38, ease: "back.out(2.0)" }}, st + 0.85);
}}
}} else if (s.archetype === "cinema_broll_fullscreen") {{
if (document.getElementById(sid + "-broll-img")) {{
tl.fromTo("#" + sid + "-broll-img", {{ scale: 1.0 }}, {{ scale: 1.08, duration: dur, ease: "none" }}, st);
}}
if (document.getElementById(sid + "-broll-title")) {{
tl.fromTo("#" + sid + "-broll-title", {{ opacity: 0, y: 20 }}, {{ opacity: 1, y: 0, duration: 0.55, ease: "power3.out" }}, st + 0.14);
}}
}} else if (s.archetype === "archify_architecture" && typeof anime !== "undefined") {{
var archTl = anime.timeline({{ autoplay: false }});
archTl
.add({{
targets: "." + sid + "-arch-node",
opacity: [0, 1],
translateY: [18, 0],
delay: anime.stagger(140),
duration: 520,
easing: "easeOutCubic",
}})
.add({{
targets: "." + sid + "-arch-path",
strokeDashoffset: [anime.setDashoffset, 0],
delay: anime.stagger(160),
duration: 900,
easing: "easeInOutSine",
}}, 180);
bindAnimeToMainTimeline(archTl, st + 0.12, Math.min(2.2, dur * 0.65));
}} else if (s.archetype === "anatomy_mechanic") {{
tl.fromTo("#" + sid + "-gear-a", {{ rotation: 0 }}, {{ rotation: 180, svgOrigin: "0 0", duration: dur, ease: "none" }}, st);
tl.fromTo("#" + sid + "-gear-b", {{ rotation: 0 }}, {{ rotation: -270, svgOrigin: "0 0", duration: dur, ease: "none" }}, st);
tl.fromTo("#" + sid + "-anat-beam", {{ opacity: 0.15 }}, {{ opacity: 1, duration: 0.5, ease: "power2.out" }}, st + Math.min(1.2, dur * 0.45));
const aCount = Math.min(4, Math.max(1, s.bulletsCount));
for (let k = 0; k < aCount; k++) {{
tl.fromTo("#" + sid + "-anat-step-" + k, {{ opacity: 0, x: 26 }}, {{ opacity: 1, x: 0, duration: 0.36, ease: "power2.out" }}, st + 0.18 + k * 0.22);
}}
if (typeof anime !== "undefined") {{
var pinTl = anime.timeline({{ autoplay: false }});
pinTl.add({{
targets: "." + sid + "-anat-pin",
translateY: [-28, 0],
opacity: [0.35, 1],
delay: anime.stagger(220),
duration: 600,
easing: "easeOutBack",
}});
bindAnimeToMainTimeline(pinTl, st + 0.20, Math.min(1.8, dur * 0.55));
}}
}} else if (s.archetype === "anime_svg_chart" && typeof anime !== "undefined") {{
var chartTl = anime.timeline({{ autoplay: false }});
chartTl
.add({{
targets: "." + sid + "-chart-line",
strokeDashoffset: [anime.setDashoffset, 0],
duration: 1100,
delay: anime.stagger(180),
easing: "easeInOutQuart",
}})
.add({{
targets: "#" + sid + "-chart-area",
opacity: [0, 1],
duration: 600,
easing: "easeOutQuad",
}}, 500)
.add({{
targets: "." + sid + "-chart-dot",
opacity: [0, 1],
translateY: [14, 0],
delay: anime.stagger(160),
duration: 450,
easing: "easeOutBack",
}}, 320);
bindAnimeToMainTimeline(chartTl, st + 0.14, Math.min(2.4, dur * 0.68));
for (let k = 0; k < 3; k++) {{
if (document.getElementById(sid + "-gauge-card-" + k)) {{
tl.fromTo("#" + sid + "-gauge-card-" + k, {{ opacity: 0, x: 28 }}, {{ opacity: 1, x: 0, duration: 0.4, ease: "power2.out" }}, st + 0.24 + k * 0.2);
}}
}}
}} else if (s.archetype === "custom_viz_stage") {{
tl.fromTo("#" + sid + "-viz-frame", {{ opacity: 0, scale: 0.96 }}, {{ opacity: 1, scale: 1.0, duration: 0.48, ease: "power3.out" }}, st + 0.10);
var hostEl = document.getElementById(sid + "-custom-svg-host");
if (hostEl && typeof anime !== "undefined") {{
var drawPaths = hostEl.querySelectorAll("path, line, polyline");
if (drawPaths.length > 0 && drawPaths.length <= 120) {{
var custTl = anime.timeline({{ autoplay: false }});
custTl.add({{
targets: drawPaths,
strokeDashoffset: [anime.setDashoffset, 0],
delay: anime.stagger(Math.max(12, Math.floor(700 / drawPaths.length))),
duration: 850,
easing: "easeInOutSine",
}});
bindAnimeToMainTimeline(custTl, st + 0.18, Math.min(2.2, dur * 0.65));
}}
}}
}} else if (s.archetype === "changelog_vertical") {{
tl.fromTo("#" + sid + "-clog-spine", {{ scaleY: 0 }}, {{ scaleY: 1, duration: Math.min(1.4, dur * 0.6), ease: "power2.out" }}, st + 0.12);
const rCount = Math.min(6, Math.max(1, s.bulletsCount));
for (let k = 0; k < rCount; k++) {{
tl.fromTo("#" + sid + "-clog-" + k, {{ opacity: 0, x: 28 }}, {{ opacity: 1, x: 0, duration: 0.38, ease: "power2.out" }}, st + 0.18 + k * 0.22);
}}
}} else if (s.archetype === "mission_staircase") {{
for (let k = 0; k < 5; k++) {{
tl.fromTo("#" + sid + "-mrow-" + k, {{ opacity: 0, x: -28 }}, {{ opacity: 1, x: 0, duration: 0.36, ease: "power2.out" }}, st + 0.14 + k * 0.16);
tl.fromTo("#" + sid + "-mblock-" + k, {{ opacity: 0, scaleY: 0.1 }}, {{ opacity: 1, scaleY: 1.0, duration: 0.48, ease: "back.out(1.3)" }}, st + 0.18 + k * 0.16);
}}
}} else if (s.archetype === "swarm_network") {{
tl.fromTo("#" + sid + "-swarm-hub", {{ opacity: 0, scale: 0.75 }}, {{ opacity: 1, scale: 1.0, duration: 0.48, ease: "back.out(1.6)" }}, st + 0.10);
for (let k = 0; k < 5; k++) {{
tl.fromTo("#" + sid + "-snode-" + k, {{ opacity: 0, scale: 0.84 }}, {{ opacity: 1, scale: 1.0, duration: 0.40, ease: "back.out(1.4)" }}, st + 0.24 + k * 0.12);
}}
}} else if (s.archetype === "pricing_matrix") {{
const pmRows = Math.min(5, Math.max(1, s.bulletsCount));
for (let k = 0; k < pmRows; k++) {{
tl.fromTo("#" + sid + "-pm-row-" + k, {{ opacity: 0, y: 18 }}, {{ opacity: 1, y: 0, duration: 0.36, ease: "power2.out" }}, st + 0.18 + k * 0.18);
}}
}} else if (s.archetype === "arc_cards") {{
const numEl = document.getElementById(sid + "-counter");
const counterProxy = {{ val: 0 }};
if (numEl) {{
tl.fromTo(counterProxy, {{ val: 0 }}, {{ val: s.statNumber, duration: Math.min(1.05, dur * 0.45), ease: "power2.out", onUpdate: function () {{ numEl.textContent = String(Math.round(counterProxy.val)); }} }}, st + 0.16);
}}
const cardCount = Math.min(9, Math.max(1, s.bulletsCount));
for (let k = 0; k < cardCount; k++) {{
tl.fromTo("#" + sid + "-arc-card-" + k, {{ opacity: 0, y: 36, scale: 0.92 }}, {{ opacity: 1, y: 0, scale: 1.0, duration: 0.46, ease: "back.out(1.35)" }}, st + 0.14 + k * 0.055);
}}
}} else if (s.archetype === "mockup_steps") {{
tl.fromTo("#" + sid + "-left-mock", {{ opacity: 0, x: -34 }}, {{ opacity: 1, x: 0, duration: 0.48, ease: "power3.out" }}, st + 0.08);
for (let k = 0; k < 3; k++) {{
tl.fromTo("#" + sid + "-step-card-" + k, {{ opacity: 0, x: 36 }}, {{ opacity: 0.52, x: 0, duration: 0.38, ease: "power2.out" }}, st + 0.12 + k * 0.08);
const beatInfo = s.beats[Math.min(k, s.beats.length - 1)];
const focusTime = beatInfo ? Math.max(st + 0.32, beatInfo.start) : (st + 0.35 + k * 1.2);
tl.to("#" + sid + "-step-card-" + k, {{ opacity: 1, scale: 1.02, borderColor: CHOREO.themeAccent, backgroundColor: CHOREO.themeCardActive, duration: 0.28, ease: "power2.out", immediateRender: false }}, focusTime);
}}
}} else if (s.archetype === "book_quote") {{
tl.fromTo("#" + sid + "-book-shell", {{ opacity: 0, scale: 0.92, rotationX: 12 }}, {{ opacity: 1, scale: 1.0, rotationX: 4, duration: 0.56, ease: "power3.out" }}, st + 0.06);
tl.fromTo("#" + sid + "-right-leaf", {{ rotationY: -65, opacity: 0.4 }}, {{ rotationY: 0, opacity: 1, duration: 0.65, ease: "power3.out" }}, st + 0.12);
const hlTime = s.beats.length > 1 ? s.beats[1].start : st + 0.95;
tl.fromTo("#" + sid + "-hl-bar", {{ scaleX: 0 }}, {{ scaleX: 1, duration: 0.68, ease: "power2.inOut" }}, Math.max(st + 0.48, hlTime));
}} else if (s.archetype === "notebook_flip") {{
tl.fromTo("#" + sid + "-nb-wrap", {{ opacity: 0, y: 28, scale: 0.95 }}, {{ opacity: 1, y: 0, scale: 1.0, duration: 0.5, ease: "power3.out" }}, st + 0.06);
for (let k = 0; k < 4; k++) {{
tl.fromTo("#" + sid + "-nb-item-" + k, {{ opacity: 0, x: 26 }}, {{ opacity: 1, x: 0, duration: 0.36, ease: "back.out(1.3)" }}, st + 0.22 + k * 0.18);
}}
}} else if (s.archetype === "bento_grid") {{
for (let k = 0; k < 4; k++) {{
tl.fromTo("#" + sid + "-bento-" + k, {{ opacity: 0, y: 32, scale: 0.94 }}, {{ opacity: 1, y: 0, scale: 1.0, duration: 0.46, ease: "back.out(1.35)" }}, st + 0.12 + k * 0.14);
}}
}} else if (s.archetype === "vs_comparison") {{
tl.fromTo("#" + sid + "-vs-left", {{ opacity: 0, x: -40 }}, {{ opacity: 1, x: 0, duration: 0.46, ease: "power3.out" }}, st + 0.12);
tl.fromTo("#" + sid + "-vs-badge", {{ opacity: 0, scale: 0.4 }}, {{ opacity: 1, scale: 1.0, duration: 0.42, ease: "back.out(1.8)" }}, st + 0.28);
tl.fromTo("#" + sid + "-vs-right", {{ opacity: 0, x: 40 }}, {{ opacity: 1, x: 0, duration: 0.48, ease: "power3.out" }}, st + 0.36);
}} else if (s.archetype === "data_bars") {{
const rowCount = Math.min(4, Math.max(1, s.bulletsCount));
for (let k = 0; k < rowCount; k++) {{
tl.fromTo("#" + sid + "-bar-row-" + k, {{ opacity: 0, y: 20 }}, {{ opacity: 1, y: 0, duration: 0.36, ease: "power2.out" }}, st + 0.12 + k * 0.14);
tl.fromTo("#" + sid + "-bar-fill-" + k, {{ scaleX: 0 }}, {{ scaleX: 1, duration: 0.75, ease: "power3.out" }}, st + 0.24 + k * 0.16);
}}
}} else if (s.archetype === "process_timeline") {{
tl.fromTo("#" + sid + "-tl-beam", {{ scaleX: 0 }}, {{ scaleX: 1, duration: Math.min(1.8, dur * 0.65), ease: "power2.inOut" }}, st + 0.2);
for (let k = 0; k < 4; k++) {{
tl.fromTo("#" + sid + "-tl-node-" + k, {{ opacity: 0, y: 28, scale: 0.92 }}, {{ opacity: 1, y: 0, scale: 1.0, duration: 0.42, ease: "back.out(1.4)" }}, st + 0.18 + k * 0.24);
}}
}} else if (s.archetype === "terminal_flow") {{
tl.fromTo("#" + sid + "-term-win", {{ opacity: 0, y: 24 }}, {{ opacity: 1, y: 0, duration: 0.45, ease: "power3.out" }}, st + 0.08);
tl.fromTo("#" + sid + "-cmd-clip", {{ clipPath: "inset(0 100% 0 0)" }}, {{ clipPath: "inset(0 0% 0 0)", duration: 1.05, ease: "steps(28)" }}, st + 0.26);
tl.fromTo("#" + sid + "-term-log", {{ opacity: 0, y: 8 }}, {{ opacity: 1, y: 0, duration: 0.35, ease: "power2.out" }}, st + 1.38);
const flowTime = s.beats.length > 1 ? s.beats[1].start : st + 1.6;
tl.fromTo("#" + sid + "-pulse-dot", {{ x: 0, opacity: 0 }}, {{ x: 180, opacity: 1, duration: 0.72, ease: "power2.inOut" }}, Math.max(st + 0.6, flowTime - 0.1));
tl.to("#" + sid + "-node-r", {{ borderColor: CHOREO.themeAccent, backgroundColor: CHOREO.themeCardActive, scale: 1.03, duration: 0.34, ease: "back.out(1.4)", immediateRender: false }}, Math.max(st + 1.1, flowTime + 0.45));
}} else {{
for (let k = 0; k < 3; k++) {{
tl.fromTo("#" + sid + "-pillar-" + k, {{ opacity: 0, y: 36, scale: 0.94 }}, {{ opacity: 1, y: 0, scale: 1.0, duration: 0.45, ease: "back.out(1.3)" }}, st + 0.16 + k * 0.24);
}}
const footTime = s.beats.length > 1 ? s.beats[s.beats.length - 1].start : st + 1.1;
tl.fromTo("#" + sid + "-summary-foot", {{ opacity: 0, y: 18, scale: 0.96 }}, {{ opacity: 1, y: 0, scale: 1.0, duration: 0.42, ease: "power3.out" }}, Math.max(st + 0.65, footTime));
}}
if (CHOREO.captionStyle !== "none") {{
s.beats.forEach(function (b, bIdx) {{
const boxId = "#cap-s" + (idx + 1) + "-b" + (bIdx + 1) + "-box";
if (b.isContinuation) {{
tl.fromTo(boxId, {{ opacity: 0.25, y: 3 }}, {{ opacity: 1, y: 0, duration: 0.12, ease: "power1.out" }}, b.start);
}} else {{
const easeName = CHOREO.captionStyle === "kinetic_pop" ? "back.out(1.75)" : "power2.out";
tl.fromTo(boxId, {{ opacity: 0, y: 8, scale: CHOREO.captionStyle === "kinetic_pop" ? 0.94 : 1.0 }}, {{ opacity: 1, y: 0, scale: 1.0, duration: 0.18, ease: easeName }}, b.start);
}}
}});
}}
}});
if (CHOREO.captionStyle === "pill_karaoke") {{
CHOREO.karaoke.forEach(function (km) {{
var totalW = km.weights.reduce(function (a, b) {{ return a + b; }}, 0) || 1;
var cur = km.start;
km.wordIds.forEach(function (wid, wi) {{
var wDur = Math.max(0.08, (km.weights[wi] / totalW) * km.duration);
tl.to("#" + wid, {{ backgroundColor: "#38bdf8", color: "#04101f", scale: 1.06, duration: 0.08, ease: "power2.out", immediateRender: false }}, cur);
if (wi < km.wordIds.length - 1) {{
tl.to("#" + wid, {{ backgroundColor: "rgba(0,0,0,0)", color: "#ffffff", scale: 1.0, duration: 0.08, immediateRender: false }}, cur + wDur);
}}
cur += wDur;
}});
}});
}}
window.__IS_STANDALONE_BROWSER = !window.__timelines && !window.__offlineCapture;
window.__timelines = window.__timelines || {{}};
window.__CHOREO_SPEC = CHOREO;
window.__timelines["main"] = tl;
tl.seek(0);
</script>
<script src="assets/js/standalone_player.js"></script>
</body>
</html>
"""
index_path = project_dir / "index.html"
index_path.write_text(html_doc, encoding="utf-8")
return index_path
"""
HyperFrames HTML Composition Compiler v3.0 (`html_builder.py`)
Supports:
- 10 Procedural Canvas + Theme Background Presets (`--bg`, incl. `wireframe_globe`, `isometric_hud_grid`, `auto`, `cycle`)
- 3 HUD Styles (`--hud-style`: `chapter_tabs`, `tech_briefing`, `minimal`)
- 6 Subtitle / Caption Styles (`--caption-style`: `glass_dual`, `briefing_clean`, `pill_karaoke`, `cinema_minimal`, `neon_bar_left`, `kinetic_pop`)
- 16 Visual Motion Scene Archetypes (incl. IT톡톡 Deep-Dive Briefings, Text Scramble, Real Video/Image PiP Frames, Vertical Changelog, 3D Mission Staircase, /swarm Network Graph, Pricing Matrix, Bento Grid, 3D Open-Book Flip, Spiral Notebook, etc.)
"""
from __future__ import annotations
import html
import json
import math
import re
import shutil
import subprocess
import urllib.request
from pathlib import Path
from typing import Any
from deck_video_pipeline.themes_and_presets import (
BACKGROUND_PRESETS,
CANVAS_RENDERERS_JS,
auto_select_background,
)
from deck_video_pipeline.pronunciation_engine import balance_subtitle_lines
PIPELINE_ROOT = Path(__file__).resolve().parent
PRETENDARD_URL = "https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/packages/pretendard/dist/web/variable/woff2/PretendardVariable.woff2"
GSAP_URL = "https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"
def _ensure_static_vendor_assets(offline: bool = True) -> tuple[Path, Path]:
font_src = PIPELINE_ROOT / "assets" / "fonts" / "PretendardVariable.woff2"
gsap_src = PIPELINE_ROOT / "assets" / "js" / "gsap.min.js"
font_src.parent.mkdir(parents=True, exist_ok=True)
gsap_src.parent.mkdir(parents=True, exist_ok=True)
if offline:
return font_src, gsap_src
if not font_src.exists() or font_src.stat().st_size < 100_000:
urllib.request.urlretrieve(PRETENDARD_URL, str(font_src))
if not gsap_src.exists() or gsap_src.stat().st_size < 10_000:
urllib.request.urlretrieve(GSAP_URL, str(gsap_src))
return font_src, gsap_src
def _esc(val: Any) -> str:
return html.escape(str(val or ""), quote=True)
def _esc_balanced_sub(val: Any, lang: str = "ko") -> str:
balanced = balance_subtitle_lines(str(val or ""), lang=lang)
return "<br class=\"cap-br\" />".join(_esc(part) for part in balanced.split("\n"))
def _split_card_item(raw: str, idx: int) -> tuple[str, str]:
if "|" in raw:
parts = [x.strip() for x in raw.split("|")]
return parts[0], " · ".join(parts[1:])
if "·" in raw:
left, right = [x.strip() for x in raw.split("·", 1)]
return left, right
words = raw.strip().split()
if len(words) >= 3:
return " ".join(words[:2]), " ".join(words[2:])
return f"포인트 {idx + 1:02d}", raw.strip()
# ---------------------------------------------------------------------------
# 6 New IT톡톡 Tech-Briefing Scene Renderers (v3.0)
# ---------------------------------------------------------------------------
def _render_hero_3d_briefing_scene(slide: dict[str, Any], s_idx: int) -> str:
sid = f"s{s_idx + 1}"
hero_word = slide.get("hero_word") or slide.get("title", "TECH BRIEFING")
sub_line = slide.get("subtitle") or slide.get("highlight_quote") or ""
bullets = slide.get("bullets") or ["화면", "음성", "모델", "/swarm", "워크플로", "요금"]
pill_colors = [
("#34d399", "rgba(6, 78, 59, 0.78)"),
("#a78bfa", "rgba(46, 16, 101, 0.78)"),
("#38bdf8", "rgba(12, 74, 110, 0.78)"),
("#fbbf24", "rgba(120, 53, 15, 0.78)"),
("#fb7185", "rgba(136, 19, 55, 0.78)"),
("#fdba74", "rgba(124, 45, 18, 0.78)"),
("#cbd5e1", "rgba(30, 41, 59, 0.82)"),
]
tags_html = []
for i, b in enumerate(bullets[:7]):
label = b.split("|")[0].strip()[:12]
b_col, bg_col = pill_colors[i % len(pill_colors)]
tags_html.append(
f'<span id="{sid}-htag-{i}" class="hero-topic-pill" style="border-color:{b_col}; background:{bg_col};">{_esc(label)}</span>'
)
src_note = (
f'<div class="hero-meta-note">{_esc(slide["source_note"])}</div>'
if slide.get("source_note")
else ""
)