/* 기본 스타일 초기화 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1a6b4a;
    --primary-light: #2e9d6e;
    --secondary: #0d3b6e;
    --accent: #f39c12;
    --accent-light: #f5b942;
    --white: #ffffff;
    --bg-light: #f0f7f4;
    --text-dark: #1a2e25;
    --text-mid: #4a6055;
    --text-light: #7a9288;
    --border: #c8e0d5;
}

body {
    font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', Arial, sans-serif;
    background: linear-gradient(135deg, #0d3b6e 0%, #1a6b4a 100%);
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.6;
}

/* 공통 컨테이너 */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* 화면 전환 관리 */
.screen {
    display: none;
    width: 100%;
    min-height: 100vh;
    position: relative;
}

.screen.active {
    display: block;
}

/* ===========================
   시작 화면
=========================== */
.start-header {
    text-align: center;
    margin-bottom: 30px;
}

.start-header h1 {
    font-size: 2.2rem;
    color: white;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.3);
    margin-bottom: 8px;
    line-height: 1.3;
}

.start-header .subtitle {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.85);
    font-weight: 300;
}

.intro-card {
    background: white;
    border-radius: 24px;
    padding: 36px 28px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    text-align: center;
    width: 100%;
    max-width: 520px;
}

.intro-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

.intro-description {
    font-size: 1.05rem;
    color: var(--text-mid);
    line-height: 1.8;
    margin-bottom: 28px;
}

.intro-features {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.feature-tag {
    background: var(--bg-light);
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 500;
}

.start-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 16px 48px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(26,107,74,0.35);
    width: 100%;
    max-width: 300px;
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(26,107,74,0.45);
}

/* ===========================
   테스트 화면
=========================== */
.progress-wrapper {
    width: 100%;
    max-width: 520px;
    margin-bottom: 24px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-label {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
    font-weight: 500;
}

.progress-count {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.9);
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.25);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
    border-radius: 4px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

.question-card {
    background: white;
    border-radius: 24px;
    padding: 36px 28px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    text-align: center;
    width: 100%;
    max-width: 520px;
}

.question-category {
    display: inline-block;
    background: var(--bg-light);
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.question-emoji {
    font-size: 2.5rem;
    margin-bottom: 14px;
}

.question-text {
    font-size: 1.35rem;
    color: var(--text-dark);
    margin-bottom: 28px;
    font-weight: 600;
    line-height: 1.5;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    background: #f8faf9;
    border: 2px solid var(--border);
    border-radius: 14px;
    padding: 16px 20px;
    font-size: 1rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    font-family: inherit;
}

.option-btn:hover {
    background: var(--bg-light);
    border-color: var(--primary);
    transform: translateX(4px);
    color: var(--primary);
}

.option-btn.selected {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-color: var(--primary);
    color: white;
    transform: translateX(4px);
}

.option-emoji {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
    font-weight: 500;
    line-height: 1.4;
}

/* ===========================
   결과 화면
=========================== */
.result-header {
    text-align: center;
    margin-bottom: 24px;
}

.result-header h2 {
    font-size: 2rem;
    color: white;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.3);
    margin-bottom: 8px;
}

.result-header p {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.85);
}

.result-card {
    background: white;
    border-radius: 24px;
    padding: 36px 28px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 520px;
    margin-bottom: 20px;
}

.result-type-badge {
    text-align: center;
    margin-bottom: 28px;
    padding: 28px 20px;
    border-radius: 18px;
    background: var(--bg-color, #e8f5e9);
}

.result-type-emoji {
    font-size: 4rem;
    margin-bottom: 12px;
    animation: float 3s ease-in-out infinite;
}

.result-type-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--type-color, #1a6b4a);
    margin-bottom: 8px;
}

.result-type-tagline {
    font-size: 0.95rem;
    color: var(--text-mid);
    font-style: italic;
}

/* 점수 바 */
.score-display {
    background: var(--bg-light);
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 24px;
    text-align: center;
}

.score-label {
    font-size: 0.85rem;
    color: var(--text-mid);
    margin-bottom: 8px;
    font-weight: 500;
}

.score-bar-wrapper {
    background: #e0e0e0;
    border-radius: 8px;
    height: 12px;
    overflow: hidden;
    margin-bottom: 6px;
}

.score-bar-fill {
    height: 100%;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-value {
    font-size: 0.85rem;
    color: var(--text-mid);
    font-weight: 600;
}

/* 섹션 공통 */
.result-section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-description {
    font-size: 1rem;
    color: var(--text-mid);
    line-height: 1.75;
    background: var(--bg-light);
    padding: 16px 20px;
    border-radius: 14px;
    border-left: 4px solid var(--primary);
}

/* 강점/주의 리스트 */
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.strength-tag {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.caution-tag {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* 추천 상품 */
.products-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    transition: all 0.2s ease;
}

.product-item:hover {
    border-color: var(--primary);
    background: white;
    transform: translateX(3px);
}

.product-emoji {
    font-size: 1.5rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.product-info {
    flex: 1;
}

.product-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 3px;
}

.product-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.4;
}

/* 첫 단계 */
.first-step-box {
    background: linear-gradient(135deg, #fff8e1 0%, #fff3cd 100%);
    border: 2px solid var(--accent);
    border-radius: 14px;
    padding: 18px 20px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.first-step-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.first-step-text {
    font-size: 0.95rem;
    color: #4a3800;
    line-height: 1.65;
    font-weight: 500;
}

/* 투자 유의사항 */
.disclaimer-box {
    background: #fff8f0;
    border: 1px solid #ffd180;
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 24px;
}

.disclaimer-title {
    font-size: 1rem;
    font-weight: 700;
    color: #e65100;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.disclaimer-text {
    font-size: 0.85rem;
    color: #5d4037;
    line-height: 1.8;
    white-space: pre-line;
}

/* AdSense */
.ad-container {
    margin: 24px 0;
    padding: 10px;
    text-align: center;
    background: #f8f9fa;
    border-radius: 10px;
    min-height: 90px;
}

/* 액션 버튼 */
.result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 8px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 520px;
}

.share-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(26,107,74,0.3);
    font-family: inherit;
}

.restart-btn {
    background: linear-gradient(135deg, #546e7a 0%, #78909c 100%);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(84,110,122,0.3);
    font-family: inherit;
}

.share-btn:hover, .restart-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(0,0,0,0.25);
}

/* 로딩 화면 */
.loading-card {
    background: white;
    border-radius: 24px;
    padding: 56px 32px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    text-align: center;
    width: 100%;
    max-width: 400px;
}

.loading-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-text {
    font-size: 1.2rem;
    color: var(--text-mid);
    font-weight: 500;
}

.loading-dots {
    display: inline-block;
    animation: dots 1.5s infinite;
}

/* 공유 모달 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    margin: 15% auto;
    border-radius: 22px;
    width: 90%;
    max-width: 380px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.3);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.close-btn:hover {
    background: rgba(255,255,255,0.35);
}

.modal-body {
    padding: 24px;
}

.share-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.share-option {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-dark);
    font-family: inherit;
    font-weight: 500;
}

.share-option:hover {
    background: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    color: var(--primary);
}

.share-icon {
    font-size: 1.6rem;
}

/* 다중 선택 */
.multi-select-hint {
    font-size: 0.82rem;
    color: var(--text-light);
    background: var(--bg-light);
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    text-align: center;
    margin-bottom: 4px;
}

.multi-select-btn .check-icon {
    font-size: 1rem;
    font-weight: 700;
    color: transparent;
    transition: color 0.2s;
    flex-shrink: 0;
    width: 20px;
    text-align: right;
}

.multi-select-btn.selected .check-icon {
    color: white;
}

.multi-next-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(26,107,74,0.3);
    font-family: inherit;
    width: 100%;
    margin-top: 8px;
}

.multi-next-btn:disabled {
    background: #c8d8d2;
    box-shadow: none;
    cursor: not-allowed;
    color: rgba(255,255,255,0.7);
}

.multi-next-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(26,107,74,0.4);
}

/* 애니메이션 */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.8; }
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* 반응형 */
@media (max-width: 768px) {
    .container { padding: 16px; }
    .start-header h1 { font-size: 1.8rem; }
    .intro-card, .question-card, .result-card {
        padding: 28px 20px;
    }
    .question-text { font-size: 1.2rem; }
    .result-header h2 { font-size: 1.7rem; }
    .result-type-name { font-size: 1.5rem; }
    .result-actions { flex-direction: column; align-items: center; }
    .share-btn, .restart-btn { width: 100%; max-width: 300px; }
}

@media (max-width: 480px) {
    .start-header h1 { font-size: 1.55rem; }
    .intro-icon { font-size: 3rem; }
    .question-text { font-size: 1.1rem; }
    .option-btn { font-size: 0.9rem; padding: 14px 16px; }
    .result-type-emoji { font-size: 3rem; }
    .result-type-name { font-size: 1.35rem; }
    .share-options { grid-template-columns: 1fr; }
}

/* 접근성 */
.option-btn:focus, .start-btn:focus, .share-btn:focus,
.restart-btn:focus, .share-option:focus {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}
