
    i7                     f   d Z ddlZddlZddlZddlmZ ddlZddlmZ ddl	m
Z
mZmZmZ ej                  j                  d e ee      j$                               ddlZdZdZdZeZd	Zd
ZdZdZeZdZdZdZe
dz  Z e dz  Z!e dz  Z"e dz  Z#dZ$dZ%dZ&de'fdZ(deddfdZ)ddZ*e+dk(  r e*        yy)u5  컨셉 #48 MAD Stars Digital Interactive — T.O.P Recruiting Meta Ad.

Inspired by MAD Stars (Busan International Ad Festival) Digital Category winners:
- Dentsu "My Japan Railway"
- McDonald's "Fries Beat"
- Apple "Shot on iPhone"

Style: Electric blue + coral on dark navy, tech-forward, AI era messaging.
    N)Path)sync_playwright)WORKSPACE_ROOTFONT_DIRCORE_METRIC_MIN_PX
CTA_MIN_PX          *   .   4   D   g?g333333?gffffff?z?output/meta-ads/concept-catalog/48-madstars-digital-interactivezbg.jpgz
sample.pngz#48-madstars-digital-interactive.pngz0https://generativelanguage.googleapis.com/v1betau  Abstract futuristic digital network visualization, dark navy blue background (#1A1A2E), glowing cyan and electric blue (#0099FF) node connection lines forming an interconnected network graph, bright luminous data nodes at intersection points with a soft cyan glow, diagonal light streak from top-right to bottom-left in electric blue with motion blur, subtle floating particles of light scattered across the frame, large semi-transparent circular gradient orb in bottom-right corner in deep blue, abstract circuit board micro-patterns faintly visible in the bottom-left corner, deep space atmosphere with depth layers — foreground nodes bright, background nodes dim, cinematic wide bokeh, volumetric light rays, overall mood: premium tech startup, AI-powered, futuristic fintech, color palette: #1A1A2E background, #0099FF cyan glows, no orange elements in background, square 1:1 format, no text, no watermarks, ultra high definitionu  <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
  @font-face {
    font-family: 'Pretendard';
    src: url('file://__FONT_DIR__/Pretendard-Black.otf') format('opentype');
    font-weight: 900;
  }
  @font-face {
    font-family: 'Pretendard';
    src: url('file://__FONT_DIR__/Pretendard-ExtraBold.otf') format('opentype');
    font-weight: 800;
  }
  @font-face {
    font-family: 'Pretendard';
    src: url('file://__FONT_DIR__/Pretendard-Bold.otf') format('opentype');
    font-weight: 700;
  }
  @font-face {
    font-family: 'Pretendard';
    src: url('file://__FONT_DIR__/Pretendard-SemiBold.otf') format('opentype');
    font-weight: 600;
  }
  @font-face {
    font-family: 'Pretendard';
    src: url('file://__FONT_DIR__/Pretendard-Medium.otf') format('opentype');
    font-weight: 500;
  }
  @font-face {
    font-family: 'Pretendard';
    src: url('file://__FONT_DIR__/Pretendard-Regular.otf') format('opentype');
    font-weight: 400;
  }

  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  body {
    width: 1080px;
    height: 1080px;
    overflow: hidden;
    background: #1A1A2E;
  }

  .canvas {
    position: relative;
    width: 1080px;
    height: 1080px;
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
    background-color: #1A1A2E;
    background-image: url('__BG_PATH__');
    background-size: cover;
    background-position: center;
    overflow: hidden;
  }

  /* 다크 오버레이 그라디언트 — 왼쪽 텍스트 영역 가독성 확보 */
  .dark-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
      105deg,
      rgba(10, 10, 30, 0.82) 0%,
      rgba(15, 15, 40, 0.72) 50%,
      rgba(10, 10, 30, 0.45) 100%
    );
  }

  /* 왼쪽 강조 바 — coral/orange accent */
  .left-accent-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 10px;
    background: linear-gradient(
      to bottom,
      #FF6B35 0%,
      #FF8C5A 50%,
      #FF6B35 100%
    );
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.6);
  }

  /* 상단 레이블 */
  .top-label {
    position: absolute;
    top: 72px;
    left: 72px;
    font-size: {_SIZE_26PX}px;
    font-weight: 500;
    color: #0099FF;
    letter-spacing: 0.18em;
    text-transform: uppercase;
  }

  /* 레이블 하단 구분선 */
  .label-rule {
    position: absolute;
    top: 116px;
    left: 72px;
    width: 160px;
    height: 2px;
    background: linear-gradient(to right, #0099FF, rgba(0,153,255,0));
  }

  /* 헤드라인 블록 */
  .headline-block {
    position: absolute;
    top: 148px;
    left: 72px;
    right: 80px;
  }

  .headline {
    font-size: {_METRIC_PX}px;
    font-weight: 900;
    color: #FFFFFF;
    line-height: {_LH_1_1};
    letter-spacing: -0.03em;
    text-shadow:
      0 0 40px rgba(0, 153, 255, 0.4),
      0 2px 12px rgba(0, 0, 0, 0.6);
  }

  /* 서브 헤드라인 */
  .sub-block {
    position: absolute;
    top: 374px;
    left: 72px;
    right: 80px;
  }

  .sub-line-1 {
    font-size: {_SIZE_68PX}px;
    font-weight: 700;
    color: #FFFFFF;
    line-height: {_LH_1_2};
    letter-spacing: -0.02em;
  }

  .sub-line-2 {
    font-size: {_SIZE_68PX}px;
    font-weight: 700;
    color: #0099FF;
    line-height: {_LH_1_2};
    letter-spacing: -0.02em;
    margin-top: 4px;
    text-shadow: 0 0 24px rgba(0, 153, 255, 0.55);
  }

  /* 구분 장식 */
  .dot-row {
    position: absolute;
    top: 566px;
    left: 72px;
    display: flex;
    gap: 12px;
    align-items: center;
  }

  .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #0099FF;
    box-shadow: 0 0 8px rgba(0, 153, 255, 0.8);
  }

  .dot-line {
    width: 80px;
    height: 2px;
    background: linear-gradient(to right, #0099FF, rgba(0,153,255,0.2));
  }

  /* 본문 텍스트 */
  .body-text {
    position: absolute;
    top: 606px;
    left: 72px;
    right: 80px;
    font-size: {_SIZE_42PX}px;
    font-weight: 500;
    color: #B0C4DE;
    letter-spacing: -0.01em;
    line-height: {_LH_1_4};
  }

  /* CTA 버튼 */
  .cta-wrapper {
    position: absolute;
    top: 716px;
    left: 72px;
  }

  .cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    font-size: {_SIZE_46PX}px;
    font-weight: 800;
    color: #FFFFFF;
    background: #FF6B35;
    padding: 22px 52px;
    border-radius: 8px;
    letter-spacing: -0.01em;
    box-shadow:
      0 4px 24px rgba(255, 107, 53, 0.5),
      0 0 40px rgba(255, 107, 53, 0.25);
  }

  .cta-arrow {
    font-size: {_SIZE_46PX}px;
    font-weight: 900;
  }

  /* 하단 브랜드 영역 */
  .bottom-brand {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 180px;
    background: linear-gradient(
      to top,
      rgba(10, 10, 30, 0.95) 0%,
      rgba(10, 10, 30, 0.85) 60%,
      rgba(10, 10, 30, 0) 100%
    );
  }

  .brand-row {
    position: absolute;
    bottom: 68px;
    left: 72px;
    right: 72px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
  }

  .brand-name {
    font-size: {_SIZE_52PX}px;
    font-weight: 900;
    color: #FFFFFF;
    letter-spacing: -0.02em;
  }

  .brand-name span {
    color: #0099FF;
    margin-left: 8px;
  }

  .brand-tagline {
    font-size: {_SIZE_32PX}px;
    font-weight: 400;
    color: rgba(176, 196, 222, 0.65);
    letter-spacing: 0.02em;
  }

  /* 우상단 장식 — T mark */
  .top-right-mark {
    position: absolute;
    top: 56px;
    right: 64px;
    width: 72px;
    height: 72px;
    border: 2.5px solid rgba(0, 153, 255, 0.45);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: {_CTA_PX}px;
    font-weight: 900;
    color: rgba(0, 153, 255, 0.65);
    letter-spacing: -0.02em;
  }

  /* 수직 서브 레이블 */
  .vertical-label {
    position: absolute;
    top: 200px;
    right: 52px;
    font-size: {_SIZE_22PX}px;
    font-weight: 400;
    color: rgba(0, 153, 255, 0.35);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    writing-mode: vertical-rl;
    text-orientation: mixed;
  }
</style>
</head>
<body>
<div class="canvas">

  <!-- 다크 오버레이 -->
  <div class="dark-overlay"></div>

  <!-- 왼쪽 강조 바 -->
  <div class="left-accent-bar"></div>

  <!-- 상단 레이블 -->
  <div class="top-label">MAD STARS INSPIRED · META AD</div>
  <div class="label-rule"></div>

  <!-- 우상단 T 마크 -->
  <div class="top-right-mark">T</div>

  <!-- 수직 레이블 -->
  <div class="vertical-label">AI · SALES · 2025</div>

  <!-- 메인 헤드라인 -->
  <div class="headline-block">
    <div class="headline">AI가<br>일하게 하세요</div>
  </div>

  <!-- 서브 헤드라인 -->
  <div class="sub-block">
    <div class="sub-line-1">보험영업, 기술이</div>
    <div class="sub-line-2">판을 바꿉니다</div>
  </div>

  <!-- 구분 점 -->
  <div class="dot-row">
    <div class="dot"></div>
    <div class="dot"></div>
    <div class="dot"></div>
    <div class="dot-line"></div>
  </div>

  <!-- 본문 텍스트 -->
  <div class="body-text">T.O.P 사업단 &nbsp;|&nbsp; AI 기반 영업 자동화 시스템</div>

  <!-- CTA 버튼 -->
  <div class="cta-wrapper">
    <div class="cta-btn">팀에 합류하기 <span class="cta-arrow">→</span></div>
  </div>

  <!-- 하단 그라디언트 -->
  <div class="bottom-brand"></div>

  <!-- 브랜드 로우 -->
  <div class="brand-row">
    <div class="brand-name">T.O.P<span>사업단</span></div>
    <div class="brand-tagline">Powered by AI · 새로운 영업의 시작</div>
  </div>

</div>
</body>
</html>returnc            
         	 t        j                  d      } d|  dd}g d}|D ]u  }t         d	| d
}ddt
        igigdddgid}t        d| d       	 t        j                  |||d      }|j                  dk(  r|j                         }|j                  di g      d   j                  di       j                  dg       D ]Y  }	d|	v st        j                  |	d   d         }
t        j                  |
       t        dt         dt!        |
      dd         y  |j                  di g      d   j                  d!d"      }t        d#| d       t        d$t#        |      dd%         Nt        d&|j                   d'|j$                  dd(         x y# t        $ r}t        d|        Y d}~yd}~ww xY w# t        $ r}t        d|        Y d}~d}~ww xY w))u;   Gemini SA 토큰으로 배경 이미지를 생성합니다.z3https://www.googleapis.com/auth/generative-languageu$     [오류] SA 토큰 획득 실패: NFzBearer zapplication/json)AuthorizationzContent-Type)zgemini-2.5-flash-imagezgemini-3.1-flash-image-previewzgemini-3-pro-image-previewz/models/z:generateContentpartstextresponseModalitiesTEXTIMAGE)contentsgenerationConfigu'     배경 생성 요청 중... (모델: )x   )headersjsontimeoutu     [오류] 연결 실패:    
candidatesr   content
inlineDatadatau     배경 저장 완료:  (,z bytes)TfinishReason?u2     [오류] 이미지 파트 없음 (finishReason: u
     응답: i  z  [HTTP z] i,  )gcloud_authget_service_account_tokenRuntimeErrorprintGEMINI_API_BASE	BG_PROMPTrequestspost	Exceptionstatus_coder   getbase64	b64decodeBG_PATHwrite_byteslenstrr   )sa_tokener   models_to_trymodelurlpayloadrespr#   part	img_bytesreasons               b/home/jay/workspace/.worktrees/task-2116-dev1/tools/ai-image-gen/gen_concept48_madstars_digital.pygenerate_backgroundrD     s)   88A
 #8*-*G
M  D !%0@A!VY$7#89:!57H I
 	7wa@A	==gGSQD
 s"99;Dt,Q/Y#Wb!	 
  4' & 0 0l1CF1K LI''	24WIRIq?QQXYZ	  t,Q/33NCH  FvhaPQJs4y#/01HT--.b4C0ABC?DB a  4QC890  	.qc23	s/   F G	G (F;;G 	G%G  G%bg_pathc                    t         j                  d|       j                  dt        t                    }t        dz  }|j                  |d       t        d|        t               5 }|j                  j                         }	 |j                  ddd	      }|j                  d
|j                          d       |j                  d       |j                  t        t              d       |j!                          	 ddd       t        j#                         j$                  dz  }t        dt         d|dd       y# |j!                          w xY w# 1 sw Y   WxY w)u7   Playwright로 HTML을 1080x1080 PNG로 캡처합니다.__BG_PATH____FONT_DIR__z_concept48_overlay.htmlzutf-8)encodingu     HTML 저장: i8  )widthheight)viewportfile://networkidle)
wait_untili	  png)pathtypeNi   u     PNG 캡처 완료: r$   z.0fz KB))HTML_TEMPLATEreplacer8   r   
OUTPUT_DIR
write_textr+   r   chromiumlaunchnew_pagegotoresolvewait_for_timeout
screenshotSAMPLE_PATHclosestatst_size)rE   html	html_filepbrowserpagesize_kbs          rC   render_htmlrh     s2    			(	X	/ 	
 66I0	OI;
'(		 	a**##%	##tt-L#MDII	 1 1 345-IP!!$'OO[!1O>MMO	  ((4/G	!+bT
BC MMO	 	s%   (EA*E .E EEEc                     t         j                  dd       t        d       t        d       t        d       t        d       t        d       t        d       t               } | st        d       d	}nd
t        j                          }t        d       t        |       t        d       t        j                  t        t               t        dt                t        d       t        dt                t        dt                y )NT)parentsexist_okz<============================================================u(   컨셉 #48 MAD Stars Digital Interactiveu#   T.O.P Recruiting Meta Ad — AI Eraz>Inspired by Dentsu 'My Japan Railway', McDonald's 'Fries Beat'u-   
[1/3] 배경 이미지 생성 (Gemini AI)...uY     [경고] 배경 생성 실패. CSS 그라디언트 순수 배경으로 계속합니다. rM   u2   
[2/3] HTML 오버레이 렌더링 (Playwright)...u   
[3/3] 복사본 생성...u     복사 완료: u   
완료!z  sample.png : z  named copy : )rU   mkdirr+   rD   r5   r[   rh   shutilcopy2r^   	COPY_PATH)okbg_urls     rC   mainrs     s    TD1	(O	
45	
/0	
JK	(O	
:;		Bij7??,-.	
?@	
'(
LLi(	i[
)*	I	OK=
)*	OI;
'(    __main__)r   N),__doc__r3   rn   syspathlibr   r.   playwright.sync_apir   
gen_configr   r   r   r   rQ   insertr8   __file__parentr(   
_SIZE_22PX
_SIZE_26PX
_SIZE_32PX_CTA_PX
_SIZE_42PX
_SIZE_46PX
_SIZE_52PX
_SIZE_68PX
_METRIC_PX_LH_1_1_LH_1_2_LH_1_4rU   r5   r^   rp   r,   r-   rS   boolrD   rh   rs   __name__ rt   rC   <module>r      s     
   / O O 3tH~,,- . 











 __

x
<'>>	DG 
 cL6T 6rD D D4): zF rt   