/* Base - 따뜻한 파스텔 팔레트 */
:root {
    --brand: #4285f4;
    --text: #333;
    --bg: #fafafa;
    --muted: #666;
    --danger: #f44336;
    --success: #2e7d32;
    --success-bg: #fffef7;
    --error: #f44336;
    --error-bg: #ffebee;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --radius: 12px;
    --warm-gradient: linear-gradient(to right, #ffe9d5, #ffd4b8);
    --feature-border: #d4a373;
    --soft-orange: #ff8c42;
    --analysis-bg: transparent;
    --feature-bg: #fff4e6;
}

* { box-sizing: border-box; }

body {
    font-family: 'Pretendard', 'Inter', 'Noto Sans KR', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
}

/* ===== Header ===== */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px; 
    background: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border-radius: var(--radius);
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
}

/* 로고 크기 60px로 설정 */
.site-header .brand img {
    height: 60px; 
    width: auto;
    vertical-align: middle; 
}

.menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    align-items: center;
    min-width: auto;
    position: static;
}

.menu-list li {
    flex: 1 1 calc(25% - 20px);
    text-align: center;
}

.menu-list li a {
    display: inline-block;
    padding: 5px 6px;
    font-size: 0.90rem;
    font-weight: 600;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    transition: background .18s, color .18s;
}

.menu-list li a:hover,
.menu-list li a:focus {
    background: rgba(66,133,244,0.1);
    color: var(--brand);
}

/* ===== Container & Components ===== */
.container {
    background: white;
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    flex: 1;
}

h1 {
    color: var(--text);
    text-align: center;
    margin-bottom: 24px;
}

.canvas-container {
    text-align: center;
    margin: 20px 0;
}

#canvas {
    border: 2px solid var(--text);
    cursor: crosshair;
    border-radius: 8px;
    max-width: 100%;
    height: auto;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

/* 버튼 스타일 */
button {
    margin: 8px 5px;
    padding: 12px 20px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-primary {
    background-color: var(--brand);
    color: white;
    font-weight: bold;
}
.btn-primary:hover { filter: brightness(0.92); }
.btn-primary:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}
.btn-danger {
    background-color: var(--danger);
    color: white;
}
.btn-danger:hover { filter: brightness(0.9); }

/* 결과 박스 */
.result-box {
    margin-top: 20px;
    padding: 20px;
    font-size: 16px;
    white-space: pre-wrap;
    background: #f8f9fa;
    border-radius: var(--radius);
    border-left: 4px solid var(--brand);
    min-height: 50px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}
.result-box.loading {
    color: var(--brand);
    font-style: italic;
    background: var(--warm-gradient);
}
.result-box.error {
    color: var(--error);
    background: var(--error-bg);
    border-left-color: var(--error);
}
.result-box.success {
    color: #2d3748;
    background: linear-gradient(to bottom, #fffef7, #fff9e6);
    border-left-color: #fbbf24;
    padding: 15px;
}

/* AI 분석 결과 - 배경 투명 (카드만 보이게) */
.analysis {
    max-width: 100%;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    font-size: 1.1rem;
    line-height: 1.7;
    letter-spacing: 0.1px;
    color: #4a4a4a;
    text-align: left;
    hyphens: auto;
    white-space: pre-line;
}

.analysis p {
    margin-bottom: 0.8em;
    line-height: 1.6;
    color: #5a5a5a;
}

.analysis br {
    margin-bottom: 0.2em;
}

/* 종합 - 독립 카드 (오렌지 그라데이션) */
.summary {
    color: #6b4423;
    text-align: center;
    margin: 0 0 20px;
    padding: 16px;
    background: linear-gradient(to right, #ffe9d5, #ffd4b8);
    border-radius: var(--radius);
    font-size: 1.3rem;
    font-weight: 600;
    border: 2px solid #f4a261;
    box-shadow: 0 4px 12px rgba(244, 162, 97, 0.25);
}

/* 특징 - 각각 독립 카드 (피치 그라데이션) */
.feature {
    margin: 15px 0;
    padding: 15px;
    border-left: 4px solid var(--feature-border);
    background: linear-gradient(to bottom, #fff4e6, #ffe8cc);
    border-radius: var(--radius);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    position: relative;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    border: 1px solid #ffd4a3;
}

.feature:hover {
    box-shadow: 0 6px 16px rgba(244, 162, 97, 0.3);
    transform: translateY(-2px);
}

.feature-content {
    margin-top: 8px;
    line-height: 1.65;
    color: #4a4a4a;
    font-size: 1rem;
    white-space: pre-line;
}

.feature-title {
    color: var(--soft-orange);
    display: block;
    margin-bottom: 10px;
    font-size: 1.2rem;
    font-weight: bold;
}

/* 요약 - 독립 카드 (그린 그라데이션) */
.overall {
    margin-top: 20px;
    padding: 16px;
    background: linear-gradient(to bottom, #f0fdf4, #dcfce7);
    border-radius: var(--radius);
    text-align: center;
    font-size: 1.1rem;
    color: #166534;
    font-style: italic;
    border: 2px solid #86efac;
    box-shadow: 0 4px 12px rgba(134, 239, 172, 0.25);
    line-height: 1.5;
}

.result-wrapper {
    line-height: 1.6;
}

.error-note {
    color: var(--error);
    font-style: italic;
    padding: 12px;
    background: var(--error-bg);
    border-radius: 8px;
    text-align: center;
    border: 1px solid #f5c6cb;
}

/* ===== Footer ===== */
.site-footer {
    margin-top: 40px;
    padding: 20px;
    background-color: white;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    border-top: 1px solid #eee;
    border-radius: var(--radius);
    box-shadow: 0 -1px 4px rgba(0,0,0,0.05);
}
.site-footer a {
    color: var(--brand);
    text-decoration: none;
    margin: 0 10px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    body {
        padding: 10px;
        max-width: 100%;
    }
    .container {
        padding: 20px;
    }
    .site-header {
        flex-direction: column;
        /* 🌟 수정: 중앙 정렬로 변경 🌟 */
        align-items: center; 
    }
    .brand {
        margin-bottom: 10px;
        /* 🌟 추가: 로고 앵커 태그 내부 요소도 중앙 정렬 🌟 */
        text-align: center;
        width: 100%; 
    }
    
    .menu-list {
        justify-content: center;
        box-shadow: none; 
    }
    
    .menu-button {
        align-self: center; 
    }
    
    .analysis {
        padding: 0;
    }
    .summary {
        font-size: 1.15rem;
        padding: 12px;
        margin-bottom: 15px;
    }
    .feature {
        padding: 12px;
        margin: 12px 0;
    }
    .feature-content {
        font-size: 0.95rem;
    }
    .overall {
        padding: 12px;
        font-size: 1rem;
    }
}