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

:root {
    --primary-color: #6366f1;
    --primary-hover: #5855eb;
    --background: #ffffff;
    --surface: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: rgba(0, 0, 0, 0.1);
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

[data-theme="dark"] {
    --background: #0f172a;
    --surface: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
    --shadow: rgba(0, 0, 0, 0.3);
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: all 0.3s ease;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.language-select {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.language-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

header h1 {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
}

.theme-toggle {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 50px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    transform: scale(1.05);
    border-color: var(--primary-color);
}

.theme-toggle .sun,
.theme-toggle .moon {
    transition: all 0.3s ease;
    display: inline-block;
}

[data-theme="dark"] .theme-toggle .sun {
    opacity: 0;
    transform: rotate(180deg);
}

[data-theme="light"] .theme-toggle .moon,
[data-theme=""] .theme-toggle .moon {
    opacity: 0;
    transform: rotate(-180deg);
}

.test-container {
    background: var(--surface);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 25px var(--shadow);
    border: 1px solid var(--border);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: var(--gradient);
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

.question-container {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.question-container h2 {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.4;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.option-btn {
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 15px;
    padding: 1.5rem;
    font-size: 1rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.option-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow);
}

.option-btn:active {
    transform: translateY(0);
}

.result-container {
    text-align: center;
    animation: fadeInUp 0.6s ease;
}

.result-container h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: 2rem;
    color: var(--text-secondary);
}

.result-card {
    background: var(--background);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 2px solid var(--border);
    box-shadow: 0 5px 15px var(--shadow);
}

.mbti-type {
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.result-card h3 {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.result-card p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.characteristics {
    text-align: left;
}

.characteristics h4 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.characteristics ul {
    list-style: none;
    padding: 0;
}

.characteristics li {
    color: var(--text-secondary);
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.characteristics li:before {
    content: "✨";
    position: absolute;
    left: 0;
}

.question-info {
    text-align: center;
    margin-bottom: 1rem;
}

.question-number {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.option-btn.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}

.option-btn:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.share-btn, .restart-btn {
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 180px;
}

.share-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.share-btn:hover, .restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 102, 241, 0.3);
}

.share-btn:hover {
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none;
}

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

/* 결과 분석 스타일 */
.result-analysis {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.result-analysis h4 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    text-align: center;
}

.dimension-bars {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dimension-bar {
    background: var(--background);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid var(--border);
}

.dimension-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.dimension-score {
    font-weight: 700;
    color: var(--primary-color);
}

.dimension-progress {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.dimension-fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 4px;
    transition: width 1s ease-in-out;
}

/* 테스트 히스토리 스타일 */
.history-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: 15px;
    border: 1px solid var(--border);
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: var(--background);
    border-radius: 10px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.history-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow);
}

.history-mbti {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary-color);
}

.history-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header {
        margin-bottom: 1.5rem;
    }
    
    .test-container {
        padding: 1.5rem;
        border-radius: 15px;
    }
    
    .options {
        gap: 0.8rem;
    }
    
    .option-btn {
        padding: 1.2rem;
        font-size: 0.95rem;
    }
    
    .result-card {
        padding: 1.5rem;
        border-radius: 15px;
    }
    
    .dimension-label {
        font-size: 0.8rem;
    }
    
    .dimension-bars {
        gap: 1rem;
    }
    
    .dimension-bar {
        padding: 0.8rem;
    }
    
    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* 공유 오버레이 스타일 */
.share-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.share-modal {
    background: var(--surface);
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.share-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.share-header h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: var(--border);
    color: var(--text-primary);
}

.share-preview {
    margin-bottom: 2rem;
    text-align: center;
}

.share-result-card {
    background: var(--gradient);
    border-radius: 15px;
    padding: 1.5rem;
    color: white;
    display: inline-block;
    min-width: 200px;
}

.share-mbti-type {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.share-mbti-title {
    font-size: 1.2rem;
    opacity: 0.9;
}

.share-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
}

.share-option {
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 500;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.share-option:hover {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}

/* 알림 스타일 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 3000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    font-weight: 500;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* 애니메이션 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .test-container {
        padding: 1rem;
    }
    
    .option-btn {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .result-card {
        padding: 1rem;
    }
    
    .share-modal {
        width: 95%;
        padding: 1.5rem;
    }
    
    .share-options {
        gap: 0.6rem;
    }
    
    .share-option {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
}
