@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

:root {
    --bg-page: #F9FAFB; --bg-surface: #FFFFFF; --bg-panel: #F3F4F6;
    --text-main: #111827; --text-muted: #4B5563; --border-color: #E5E7EB;
    --accent: #2563EB; --accent-hover: #1D4ED8;
    --error: #EF4444; --toast-bg: rgba(15, 23, 42, 0.9); --toast-text: #FFFFFF;
}
[data-theme="dark"] {
    --bg-page: #111827; --bg-surface: #1F2937; --bg-panel: #374151;
    --text-main: #F9FAFB; --text-muted: #9CA3AF; --border-color: #374151;
    --accent: #3B82F6; --accent-hover: #60A5FA;
    --toast-bg: rgba(255, 255, 255, 0.9); --toast-text: #111827;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Pretendard', sans-serif; background-color: var(--bg-page); color: var(--text-main); line-height: 1.6; transition: background-color 0.3s, color 0.3s; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.hidden { display: none !important; }

/* Header & Footer */
.header-wrapper { width: 100%; background: var(--bg-surface); border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1050px; margin: 0 auto; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; }
.header-left { display: flex; align-items: center; }
.header-logo-link { display: flex; align-items: center; text-decoration: none; transition: opacity 0.2s; }
.header-logo-link:hover { opacity: 0.8; }
.header-logo { height: 36px; object-fit: contain; transform: scale(1.35); transform-origin: left center; }
.header-utils { display: flex; gap: 8px; align-items: center; }
.hub-btn-container { position: relative; display: flex; align-items: center; margin-right: 4px; }
.hub-btn { display: flex; align-items: center; gap: 6px; background: var(--bg-panel); border: 1px solid var(--border-color); text-decoration: none; color: var(--text-main); font-weight: 700; font-size: 0.85rem; transition: 0.2s; cursor: pointer; padding: 6px 12px; border-radius: 20px; }
.hub-btn:hover { border-color: var(--accent); background: rgba(37, 99, 235, 0.05); }
.hub-icon { width: 18px; height: 18px; object-fit: contain; }
.icon-btn { background: none; border: none; cursor: pointer; color: var(--text-muted); width: 36px; height: 36px; border-radius: 8px; display: flex; justify-content: center; align-items: center; transition: 0.2s; }
.icon-btn:hover { background: var(--bg-panel); color: var(--text-main); }
.icon-btn svg { width: 20px; height: 20px; stroke-width: 2.2px; }

.footer { text-align: center; padding: 40px 20px; font-size: 0.85rem; color: var(--text-muted); }
.footer p { margin-bottom: 8px; }
.footer-links { display: flex; justify-content: center; gap: 20px; margin-top: 10px; }
.footer-links a { color: var(--text-muted); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* Main Container */
.container { max-width: 1050px; margin: 40px auto; padding: 0 20px; }
.view-active { display: block; animation: fadeIn 0.3s ease-out; }
.view-hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Upload Hero */
.hero { text-align: center; margin-bottom: 40px; }
.logo-wrapper { display: flex; justify-content: center; align-items: center; margin-bottom: 20px;}
.hero-logo { height: 60px; max-width: 100%; object-fit: contain; transform: scale(1.2); }
.hero-copy { color: var(--text-muted); font-size: 1.05rem; max-width: 650px; margin: 0 auto; line-height: 1.6; word-break: keep-all; }
.pc-br { display: none; }
@media (min-width: 850px) { .pc-br { display: block; } }

/* Drag Overlay */
.drag-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(37, 99, 235, 0.9); z-index: 9999; display: flex; align-items: center; justify-content: center; color: white; transition: opacity 0.2s; }
.drag-overlay-content { text-align: center; pointer-events: none; }
.drag-icon { width: 80px; height: 80px; display: block; margin: 0 auto 15px auto; }

/* Dropzone */
.tool-section { background: var(--bg-surface); padding: 30px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.03); border: 1px solid var(--border-color); margin-bottom: 40px; }
.upload-box { display: block; border: 2px dashed var(--text-muted); border-radius: 12px; padding: 60px 20px; text-align: center; background: var(--bg-panel); cursor: pointer; transition: 0.2s; }
.upload-box:hover { border-color: var(--accent); background: rgba(37, 99, 235, 0.05); }
.upload-icon-svg { width: 60px; height: 60px; color: var(--accent); margin-bottom: 15px; }
.upload-box h2 { font-size: 1.2rem; margin-bottom: 5px; color: var(--text-main);}
.upload-sub { font-size: 0.95rem; color: var(--text-muted); margin-top: 8px; word-break: keep-all; }

/* Workspace Grid */
.workspace-header-actions { text-align: right; margin-bottom: 10px; }
.workspace-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 30px; margin-bottom: 20px; align-items: start;}
@media (max-width: 900px) { .workspace-grid { grid-template-columns: 1fr; } }

/* Preview Section */
.preview-section { background: var(--bg-page); border: 1px solid var(--border-color); border-radius: 16px; padding: 25px; display: flex; flex-direction: column; align-items: center;}
.preview-header { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 15px; }
.preview-title-wrap { display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.preview-title { font-weight: 700; font-size: 1.05rem; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}
.original-info-badge { font-size: 0.8rem; font-weight: 600; color: var(--accent); }

/* 체커보드 배경 & 캔버스 컨테이너 */
.canvas-wrapper-outer { width: 100%; display: flex; justify-content: center; align-items: center; min-height: 440px; border-radius: 12px; border: 1px solid var(--border-color); overflow: hidden;
    background-color: #f0f0f0;
    background-image: linear-gradient(45deg, #ddd 25%, transparent 25%), linear-gradient(-45deg, #ddd 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ddd 75%), linear-gradient(-45deg, transparent 75%, #ddd 75%);
    background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    padding: 20px;
}
[data-theme="dark"] .canvas-wrapper-outer { background-color: #1a1a1a; background-image: linear-gradient(45deg, #222 25%, transparent 25%), linear-gradient(-45deg, #222 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #222 75%), linear-gradient(-45deg, transparent 75%, #222 75%); }

.canvas-container { position: relative; display: flex; justify-content: center; align-items: center; max-width: 100%; max-height: 50vh; }
/* 캔버스 테두리 */
#previewCanvas { max-width: 100%; max-height: 400px; width: auto; height: auto; display: block; box-shadow: 0 0 0 2px var(--accent), 0 10px 30px rgba(0,0,0,0.3); border-radius: 4px; cursor: grab; touch-action: none; background: transparent;}
#previewCanvas:active { cursor: grabbing; }

.drag-hint-badge { position: absolute; top: 15px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.75); color: #fff; padding: 6px 14px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; pointer-events: none; opacity: 0; transition: 0.3s; z-index: 10; white-space: nowrap;}
.canvas-container:hover .drag-hint-badge { opacity: 0.9; }
.preview-notice { margin-top: 20px; font-size: 0.85rem; color: var(--text-muted); text-align: center; line-height: 1.6;}

/* Settings Panel */
.settings-section { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.03);}
.tabs { display: flex; border-bottom: 1px solid var(--border-color); background: var(--bg-panel); }
.tab-btn { flex: 1; padding: 14px 5px; background: none; border: none; font-size: 0.95rem; font-weight: 700; color: var(--text-muted); cursor: pointer; border-bottom: 3px solid transparent; }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--bg-surface);}
.tab-content-wrapper { padding: 25px 20px; flex: 1; }
.tab-content { display: none; animation: fadeIn 0.2s; }
.tab-content.active { display: block; }

/* Controls */
.control-group { margin-bottom: 25px; }
.group-label { display: block; font-weight: 700; margin-bottom: 10px; font-size: 0.95rem; color: var(--text-main);}
.input-label { display: flex; align-items: center; justify-content: space-between; font-size: 0.9rem; font-weight: 600; color: var(--text-main);}
.full-select, .full-input { width: 100%; padding: 12px; border: 1px solid var(--border-color); background: var(--bg-surface); color: var(--text-main); border-radius: 6px; font-family: inherit; font-size: 0.95rem; font-weight: 600;}
.custom-size-inputs { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.custom-size-inputs input { flex: 1; padding: 10px; border: 1px solid var(--border-color); background: var(--bg-surface); color: var(--text-main); border-radius: 6px; text-align: center; font-weight: bold;}
.name-options { background: var(--bg-panel); padding: 20px; border-radius: 8px; border: 1px solid var(--border-color);}
.name-desc { font-size: 0.8rem; color: var(--text-muted); margin-left: 28px; margin-top: 4px; }
.name-sub-input { margin-top: 12px; padding-left: 28px; }

/* Radio UI */
.segmented-control { display: flex; background: var(--bg-panel); border-radius: 8px; padding: 4px; border: 1px solid var(--border-color);}
.segmented-control label { flex: 1; text-align: center; }
.segmented-control span { display: block; padding: 10px 4px; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); cursor: pointer; border-radius: 6px; transition: 0.2s; word-break: keep-all;}
.segmented-control span:hover { background: rgba(0,0,0,0.05); }
.segmented-control input[type="radio"]:checked + span { background: var(--bg-surface); color: var(--accent); box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.mini-seg span { padding: 6px; font-size: 0.8rem; }
.radio-label { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text-main); cursor: pointer;}
.radio-label input { margin: 0; width: 16px; height: 16px; accent-color: var(--accent);}

/* Vertical Radio Cards (품질 선택용) */
.radio-vertical-group { display: flex; flex-direction: column; gap: 10px; }
.radio-card { display: flex; align-items: flex-start; gap: 12px; padding: 15px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-surface); cursor: pointer; transition: 0.2s; }
.radio-card:hover { border-color: var(--accent); }
.radio-card input[type="radio"] { margin-top: 4px; accent-color: var(--accent); width: 16px; height: 16px; }
.radio-card-content strong { display: block; font-size: 0.95rem; color: var(--text-main); margin-bottom: 4px; }
.radio-card-content p { font-size: 0.85rem; color: var(--text-muted); margin: 0; line-height: 1.4; }
.radio-card:has(input[type="radio"]:checked) { border-color: var(--accent); background: rgba(37, 99, 235, 0.05); box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1); }
.dynamic-tip-box { background: rgba(59, 130, 246, 0.08); border-left: 3px solid var(--accent); padding: 16px; border-radius: 0 8px 8px 0; font-size: 0.85rem; color: var(--text-main); line-height: 1.5; }

/* Buttons & Footer Actions */
.btn-text { background: none; border: none; color: var(--text-muted); font-weight: 600; cursor: pointer; font-size: 0.85rem; padding: 4px 8px; border-radius: 6px;}
.btn-text:hover { background: var(--bg-panel); color: var(--text-main); }
.btn-apply-all { width: 100%; background: var(--bg-panel); border: 1px solid var(--border-color); padding: 14px; border-radius: 8px; font-weight: 700; color: var(--text-main); margin-top: 25px; cursor: pointer; transition: 0.2s;}
.btn-apply-all:hover { border-color: var(--accent); color: var(--accent); }
.btn-mega { width: 100%; background: var(--accent); color: white; border: none; padding: 18px; border-radius: 10px; font-size: 1.15rem; font-weight: 800; cursor: pointer; transition: 0.2s; box-shadow: 0 4px 15px rgba(37, 99, 235, 0.25);}
.btn-mega:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-2px); }
.btn-mega:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--bg-surface); color: var(--text-main); border: 1px solid var(--border-color); padding: 12px; font-weight: 700; border-radius: 8px; cursor: pointer; transition: 0.2s;}
.btn-primary:hover { background: var(--bg-panel); }

.action-footer { padding: 25px 20px; background: var(--bg-panel); border-top: 1px solid var(--border-color); }

/* Strip Container */
.strip-container { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 12px; padding: 15px; box-shadow: 0 4px 12px rgba(0,0,0,0.02);}
.thumbnail-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 5px; }
.thumb-item { width: 70px; height: 70px; object-fit: cover; border-radius: 8px; cursor: pointer; opacity: 0.5; border: 3px solid transparent; transition: 0.2s; flex-shrink: 0; background: var(--bg-panel);}
.thumb-item.active { opacity: 1; border-color: var(--accent); transform: scale(1.05); }

/* Progress & Result Box */
.progress-bar-wrap { width: 100%; height: 16px; background: var(--border-color); border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
.progress-fill { width: 0%; height: 100%; background: var(--accent); transition: width 0.3s; }
.report-summary-box { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); padding: 15px; border-radius: 8px; text-align: center; }
#reportSummaryTitle { color: #065F46; margin-bottom: 8px; font-size: 1.05rem; font-weight: 800;}
[data-theme="dark"] #reportSummaryTitle { color: #34D399; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; text-align: left;}
th, td { padding: 8px; border-bottom: 1px solid var(--border-color); color: var(--text-main);}
th { background: var(--bg-page); position: sticky; top: 0; font-weight: 700;}

/* SEO Article */
.guide-content { background: var(--bg-surface); padding: 40px; border-radius: 16px; border: 1px solid var(--border-color); margin-top: 40px; margin-bottom: 40px;}
.guide-content h2 { border-bottom: 2px solid var(--border-color); padding-bottom: 15px; margin-bottom: 30px; font-size: 1.4rem; color: var(--text-main);}
.guide-content h3 { font-size: 1.1rem; margin: 30px 0 12px 0; color: var(--text-main); }
.guide-content p { color: var(--text-muted); font-size: 1rem; line-height: 1.7; margin-bottom: 15px; word-break: keep-all; }
.seo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; }
.seo-grid h3 { color: var(--accent); }
.seo-grid code { background: var(--bg-panel); padding: 2px 6px; border-radius: 4px; font-family: monospace; color: var(--error);}
.faq-item { margin-bottom: 20px; background: var(--bg-panel); padding: 20px; border-radius: 8px; }
.faq-item h4 { font-size: 1.05rem; margin-bottom: 10px; color: var(--accent); }
.faq-item p { margin-bottom: 0; font-size: 0.95rem; color: var(--text-main);}

/* Toast */
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: var(--toast-bg); color: var(--toast-text); padding: 12px 24px; border-radius: 30px; font-weight: 600; font-size: 0.95rem; opacity: 0; transition: 0.3s; z-index: 1000; box-shadow: 0 4px 15px rgba(0,0,0,0.2); white-space: nowrap; pointer-events: none;}
.toast.show { opacity: 1; transform: translate(-50%, -10px); }

/* Mobile */
.pc-only { display: flex; }
@media (max-width: 850px) {
    .container { margin: 20px auto; padding: 0 15px; }
    .hero h2 { font-size: 1.6rem; }
    .header-logo { height: 28px; transform: scale(1.4); }
    .option-row { flex-direction: column; align-items: stretch; gap: 10px; }
    .option-row label { min-width: 0; width: 100%; }
    .tabs { overflow-x: auto; }
    .tab-btn { min-width: 100px; white-space: nowrap; }
    .canvas-wrapper-outer { min-height: 250px; padding: 10px; }
    .pc-only { display: none !important; }
    .guide-content { padding: 30px 20px; }
}

/* --- 새로 추가된 썸네일 개별 삭제 버튼 스타일 --- */
.thumb-wrapper { position: relative; flex-shrink: 0; }
.thumb-delete-btn { 
    position: absolute; 
    top: -6px; 
    right: -6px; 
    width: 22px; 
    height: 22px; 
    background: var(--error); 
    color: white; 
    border: none; 
    border-radius: 50%; 
    font-size: 14px; 
    font-weight: bold; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.3); 
    transition: 0.2s; 
    opacity: 0; 
    z-index: 10;
}
/* 마우스를 올렸을 때만 X버튼 표시 (PC) */
.thumb-wrapper:hover .thumb-delete-btn { opacity: 1; transform: scale(1.1); }

/* 모바일에서는 X버튼이 항상 보이도록 처리 */
@media (max-width: 850px) {
    .thumb-delete-btn { 
        opacity: 1; 
        width: 24px; 
        height: 24px; 
        top: -8px; 
        right: -8px; 
    }
}

/* --- 마스터 스위치 (토글) 및 비활성화 스타일 --- */
.toggle-switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--text-muted); transition: .3s; border-radius: 26px; }
.toggle-slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
input:checked + .toggle-slider { background-color: var(--accent); }
input:checked + .toggle-slider:before { transform: translateX(20px); }

.disabled-area { opacity: 0.4; pointer-events: none; transition: opacity 0.3s ease; filter: grayscale(40%); }
