:root {
    --bg-color: #121212;
    --panel-bg: #1E1E1E;
    --border-color: #333;
    --accent-color: #4FACFE;
    --text-main: #FFF;
    --text-sub: #AAA;
    --danger-color: #FF5E5E;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Pretendard', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden; 
}

/* 3단 그리드 */
.app-container {
    display: grid;
    grid-template-columns: 320px 1fr 240px;
    height: 100%;
}

/* ===== Sidebar ===== */
.sidebar {
    background: var(--panel-bg);
    border-right: 1px solid var(--border-color);
    padding: 30px 20px;
    display: flex; flex-direction: column; gap: 24px;
    overflow-y: auto;
}
.right-panel { border-right: none; border-left: 1px solid var(--border-color); background: #181818; }

header h1 { font-size: 24px; color: var(--accent-color); margin-bottom: 5px; }
header p { font-size: 12px; color: var(--text-sub); }

.control-group label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 8px; font-weight: 600; }
.control-group input, .control-group select, .control-group textarea {
    width: 100%; padding: 12px; background: #2A2A2A; border: 1px solid #444; color: #FFF;
    border-radius: 8px; font-size: 14px; outline: none; margin-bottom: 8px;
    font-family: 'Pretendard', sans-serif; /* 폰트 상속 */
}
/* textarea 전용 스타일 추가 */
.control-group textarea {
    resize: vertical; /* 세로로만 조절 가능 */
    min-height: 80px;
    line-height: 1.5;
}

.control-group input:focus, .control-group textarea:focus { border-color: var(--accent-color); }
.button-row { display: flex; gap: 8px; }

/* 직접 입력 스타일 */
.custom-size-inputs {
    display: flex; align-items: center; gap: 10px; margin-top: -5px; margin-bottom: 10px;
    animation: fadeIn 0.3s ease;
}
.custom-size-inputs input { margin-bottom: 0; text-align: center; }
.custom-size-inputs span { color: #888; font-size: 12px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

/* Themes */
.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.theme-btn {
    width: 100%; aspect-ratio: 1; border-radius: 8px; cursor: pointer;
    border: 2px solid transparent; transition: 0.2s;
}
.theme-btn:hover { transform: scale(1.05); }
.theme-btn.active { border-color: #FFF; transform: scale(1.1); box-shadow: 0 0 10px rgba(255,255,255,0.2); }

/* Buttons */
.btn-secondary { padding: 12px; background: #333; color: #FFF; border: none; border-radius: 8px; cursor: pointer; }
.btn-secondary:hover { background: #444; }

.bottom-actions { margin-top: auto; padding-top: 20px; border-top: 1px solid #333; text-align: left; }
.btn-text {
    background: none; border: none; color: #666; font-size: 13px; cursor: pointer; padding: 0;
    transition: 0.2s; display: flex; align-items: center; gap: 5px;
}
.btn-text:hover { color: var(--danger-color); }

.save-status { font-size: 12px; color: #4FACFE; text-align: center; opacity: 0; transition: opacity 0.5s; }


/* ===== Center Canvas ===== */
.center-panel {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: #000; position: relative;
    padding: 40px; overflow-y: auto;
}
.canvas-wrapper-outer { width: 100%; display: flex; justify-content: center; max-width: 900px; }
.canvas-container { width: 100%; display: flex; align-items: center; justify-content: center; }

/* 캔버스 공통 */
.thumbnail-canvas {
    width: 100%; 
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    text-align: center; position: relative;
    padding: 60px; box-shadow: 0 0 50px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
    overflow: hidden; /* [핵심 수정] 내용이 넘쳐도 박스 크기 유지 */
}

.thumbnail-canvas.blog-size { aspect-ratio: 2 / 1; }
.thumbnail-canvas.wide-size { aspect-ratio: 16 / 9; }
.thumbnail-canvas.square-size { aspect-ratio: 1 / 1; max-width: 600px; }

.content-wrapper { position: relative; z-index: 10; width: 100%; }
.deco-icon { font-size: 80px; margin-bottom: 20px; text-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.hidden { display: none !important; }

.subtitle { font-size: 24px; font-weight: 600; opacity: 0.8; margin-bottom: 12px; display: block; }

/* [핵심 수정] 줄바꿈 지원 스타일 */
.title { 
    font-size: 58px; font-weight: 800; line-height: 1.3; 
    /* word-break: keep-all;  */
    white-space: pre-wrap; /* 엔터키(줄바꿈) 반영 */
}

.author { 
    position: absolute; bottom: -80px; left: 50%; transform: translateX(-50%);
    font-size: 16px; opacity: 0.6; white-space: nowrap;
}

/* Mockup Overlay */
.mockup-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 20; background: rgba(0, 0, 0, 0.4);
}
.guide-box {
    position: absolute; border: 2px dashed rgba(0, 255, 255, 0.8);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.3);
    top: 50%; left: 50%; transform: translate(-50%, -50%);
}
.blog-size .guide-box { height: 100%; aspect-ratio: 1/1; }
.wide-size .guide-box { width: 90%; height: 80%; }
.wide-size .mockup-overlay::after {
    content: 'Time Stamp'; position: absolute; bottom: 10px; right: 10px;
    width: 100px; height: 30px; background: rgba(255, 0, 0, 0.3);
    font-size: 10px; display: flex; align-items: center; justify-content: center; color: #fff;
}
.square-size .guide-box { width: 90%; height: 90%; }
.guide-label {
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
    background: rgba(0, 255, 255, 0.2); padding: 4px 8px; border-radius: 4px;
    color: #fff; font-size: 12px; border: 1px solid rgba(0, 255, 255, 0.5);
}

.btn-primary {
    padding: 16px 40px; font-size: 18px; font-weight: bold;
    background: var(--accent-color); color: #FFF; border: none; border-radius: 50px;
    cursor: pointer; box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
}
.ad-placeholder { background: #252525; border: 1px dashed #444; color: #555; display: flex; justify-content: center; align-items: center; font-size: 12px; }
.ad-placeholder.vertical { height: 300px; width: 100%; border-radius: 8px; }
.info-box { background: #252525; padding: 20px; border-radius: 12px; margin-top: 20px; }
.info-box h3 { font-size: 16px; margin-bottom: 10px; color: #FFF; }
.info-box p { font-size: 13px; color: #AAA; margin-bottom: 15px; }
.btn-coffee { width: 100%; padding: 10px; background: #FFDD00; color: #000; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; }

.notice-section { border-top: 1px solid #333; padding-top: 20px; margin-top: 20px; }
.notice-section h4 { font-size: 14px; color: #ccc; margin-bottom: 12px; }
.notice-list { list-style: none; padding: 0; }
.notice-list li { font-size: 13px; color: #888; padding: 8px 0; border-bottom: 1px solid #333; cursor: pointer; display: flex; justify-content: space-between; }
.notice-list li:hover { color: var(--accent-color); }

.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 100; display: flex; justify-content: center; align-items: center; }
.modal-content { background: #1E1E1E; padding: 30px; border-radius: 16px; text-align: center; width: 90%; max-width: 400px; }
.modal-content.text-left { text-align: left; }
.modal-body-text { font-size: 14px; line-height: 1.6; color: #ccc; margin-bottom: 25px; white-space: pre-wrap; }
.ad-placeholder.rect { width: 100%; height: 250px; background: #000; margin-top: 20px; }
.spinner { width: 40px; height: 40px; border: 4px solid #333; border-top-color: var(--accent-color); border-radius: 50%; margin: 0 auto; animation: spin 1s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: #AAA; margin-top: 20px; margin-bottom: 10px; }

/* Mobile */
@media (max-width: 768px) {
    body { overflow: auto; height: auto; }
    .app-container { display: flex; flex-direction: column; height: auto; }
    .center-panel { order: 1; width: 100%; padding: 20px; border-bottom: 1px solid #333; }
    .notice-section { margin-top: 30px; }
    .thumbnail-canvas { padding: 30px; }
    .thumbnail-canvas .title { font-size: 8vw; }
    .thumbnail-canvas .subtitle { font-size: 4vw; }
    .thumbnail-canvas .deco-icon { font-size: 12vw; }
    .author { bottom: -50px; font-size: 12px; }
    .left-panel { order: 2; width: 100%; border-right: none; height: auto; }
    .right-panel { display: block; order: 3; width: 100%; border-left: none; border-top: 1px solid #333; padding: 20px; }
}