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

:root {
    --primary-color: #4a90e2;
    --primary-dark: #357abd;
    --primary-light: #6ba3e8;
    --secondary-color: #5b9bd5;
    --accent-color: #ff6b9d;
    --text-color: #1e293b;
    --text-light: #64748b;
    --text-white: #ffffff;
    --bg-color: #ffffff;
    --bg-light: #f0f7ff;
    --bg-card: #ffffff;
    --border-color: #d1e7ff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.08);
    --shadow-blue: 0 10px 15px -3px rgba(74, 144, 226, 0.2), 0 4px 6px -2px rgba(74, 144, 226, 0.1);
    --gradient-primary: linear-gradient(135deg, #4a90e2 0%, #5b9bd5 100%);
    --gradient-secondary: linear-gradient(135deg, #5b9bd5 0%, #6ba3e8 100%);
    --gradient-bg: linear-gradient(135deg, #4a90e2 0%, #5b9bd5 50%, #6ba3e8 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Noto Sans KR', sans-serif;
    color: var(--text-color);
    background: var(--gradient-bg);
    background-attachment: fixed;
    min-height: 100vh;
    line-height: 1.6;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-bg);
    z-index: -1;
}

.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* 헤더 */
.app-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.app-title {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--text-white);
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.5px;
}

.app-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);
}

/* STEP 컨테이너 */
.step-container {
    display: none;
    background: var(--bg-card);
    border-radius: 1.5rem;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.3s ease-in;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.step-container.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.step-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.step-description {
    font-size: 1rem;
    color: var(--text-light);
}

/* STEP 1: 관계 선택 */
.relationship-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.relationship-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 1.25rem;
    padding: 2rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
}

.relationship-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: var(--shadow-blue);
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.05) 0%, rgba(91, 155, 213, 0.05) 100%);
}

.relationship-card.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.15) 0%, rgba(91, 155, 213, 0.15) 100%);
    box-shadow: var(--shadow-blue);
    transform: translateY(-3px);
}

.relationship-icon {
    font-size: 3rem;
}

.relationship-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
}

/* STEP 2: MBTI 선택 */
.mbti-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.mbti-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mbti-input-group label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 1rem;
}

.mbti-select {
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.mbti-select:hover {
    border-color: var(--primary-color);
}

.mbti-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* 선택적 질문 */
.optional-questions {
    margin: 2.5rem 0;
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: 0.75rem;
}

.question-toggle {
    margin-bottom: 1rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
}

.toggle-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.questions-container {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.questions-container.hidden {
    display: none;
}

.question-item {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.question-item label {
    font-weight: 500;
    color: var(--text-color);
}

.radio-group {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
    cursor: pointer;
}

.radio-group input[type="radio"] {
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
}

/* 버튼 */
.step-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2.5rem;
}

.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* STEP 3: 로딩 */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 1.5rem;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(74, 144, 226, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 20px rgba(74, 144, 226, 0.3);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

/* 결과 리포트 */
.result-container {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.result-container.active {
    display: block;
}

.result-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: var(--bg-card);
    border-radius: 1rem;
    box-shadow: var(--shadow);
}

.result-main-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.result-mbti-combination {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.result-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.result-section {
    background: var(--bg-card);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.result-section .section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

/* ① 관계 요약 */
.summary-card {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(91, 155, 213, 0.1) 100%);
    padding: 2rem;
    border-radius: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.8;
    text-align: center;
    border: 2px solid rgba(74, 144, 226, 0.2);
}

/* ② 손해 보는 패턴 */
.patterns-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pattern-item {
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: 0.75rem;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.pattern-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow);
}

.pattern-rank {
    font-weight: 700;
    color: var(--primary-color);
    margin-right: 0.5rem;
}

.pattern-text {
    color: var(--text-color);
    line-height: 1.7;
}

.pattern-note {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-light);
    font-style: italic;
}

/* ③ 현실 대사 */
.dialogues-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dialogue-item {
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.05) 0%, rgba(91, 155, 213, 0.05) 100%);
    border-radius: 0.75rem;
    border: 2px solid var(--border-color);
    position: relative;
}

.dialogue-quote {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.8;
    margin-bottom: 0.5rem;
}

.dialogue-quote::before {
    content: '"';
    font-size: 2rem;
    color: var(--primary-color);
    margin-right: 0.25rem;
}

.dialogue-quote::after {
    content: '"';
    font-size: 2rem;
    color: var(--primary-color);
    margin-left: 0.25rem;
}

.dialogue-context {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 0.75rem;
}

/* ④ 감정 트리거 해설 */
.triggers-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.trigger-item {
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: 0.75rem;
}

.trigger-mbti {
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.trigger-description {
    color: var(--text-color);
    line-height: 1.7;
    margin-top: 0.5rem;
}

.trigger-insight {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(74, 144, 226, 0.1);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-color);
    font-style: italic;
    border-left: 3px solid var(--primary-color);
}

/* ⑤ 생존 전략 */
.strategy-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.strategy-section-item {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.strategy-section-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.strategy-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-left: 1rem;
}

.strategy-item {
    color: var(--text-color);
    line-height: 1.7;
    position: relative;
}

.strategy-item::before {
    content: "•";
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: -1rem;
}

.strategy-item.negative {
    color: var(--accent-color);
}

/* 결과 액션 버튼 */
.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

/* 저작권 섹션 */
.copyright-section {
    margin-top: 3rem;
    padding: 2rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.copyright-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    line-height: 1.6;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .app-title {
        font-size: 2rem;
    }

    .step-container {
        padding: 1.5rem;
    }

    .relationship-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .mbti-selection {
        grid-template-columns: 1fr;
    }

    .step-buttons,
    .result-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}
