/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --accent-color: #f59e0b;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --background-primary: #ffffff;
    --background-secondary: #f8fafc;
    --background-tertiary: #f1f5f9;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    --transition: all 0.2s ease-in-out;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background-primary);
    min-height: 100vh;
    overflow-x: hidden;
    font-display: swap;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
    color: var(--text-primary);
}

.loading-logo {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.loading-content h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.loading-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

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

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
}

/* 초기 HTML에서 콘텐츠는 항상 visible (Google 봇을 위해) */
#app {
    display: block !important;
    visibility: visible !important;
}

/* Hidden class for initial state (Google bot compatibility) */
.hidden {
    /* hidden 클래스는 JavaScript로 제어하되, 초기 HTML에서는 무시 */
    /* display: none !important; */
    /* visibility: hidden !important; */
}

.app-container {
    flex-direction: column;
    background: var(--background-primary);
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--background-primary);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: var(--transition);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    cursor: pointer;
    transition: var(--transition);
}

.logo:hover {
    opacity: 0.8;
}

.logo h1 {
    display: flex;
    align-items: center;
    font-size: 24px;
    margin: 0;
}

.header-logo {
    height: 40px; /* 이미지 크기 증가 */
    width: auto;
    margin-right: 8px; /* 오른쪽 여백 증가 */
}



.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* 언어 선택기 */
.language-selector {
    position: relative;
    display: inline-block;
}

.lang-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--background-primary);
    color: var(--text-primary);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
    justify-content: space-between;
    white-space: nowrap;
}

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

.lang-icon {
    font-size: 1rem;
}

.lang-text {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lang-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.lang-btn.active .lang-arrow {
    transform: rotate(180deg);
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--background-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    margin-top: 0.25rem;
}

.lang-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.lang-option:last-child {
    border-bottom: none;
}

.lang-option:hover {
    background: var(--background-secondary);
}

.lang-option.selected {
    background: var(--primary-color);
    color: white;
}

.lang-flag {
    font-size: 1.1rem;
}

.lang-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    padding-top: 100px;
    padding-bottom: 0;
    position: relative;
    background: var(--background-primary);
}

/* Screen Management */
.screen {
    display: none;
    min-height: calc(100vh - 100px);
    padding: 2rem 0;
}

/* 모바일에서 테스트 화면 간격 완전 제거 */
@media (max-width: 480px) {
    #testScreen.screen {
        padding: 0.5rem 0 0 0 !important;
        min-height: auto !important;
    }
    
    #testScreen .test-container {
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }
    
    #testScreen .navigation-section {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    .main-content {
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }
    
    .footer {
        padding-top: 0.25rem !important;
        margin-top: 0 !important;
    }
}

.screen.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

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

/* Main Container - FlipSimu Style */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.test-main {
    width: 100%;
    max-width: 1200px;
    margin-bottom: 3rem;
}

.hero-image-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto 2.5rem;
    display: flex;
    justify-content: center;
    animation: floatAnimation 3s ease-in-out infinite;
}

@keyframes floatAnimation {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.hero-image {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius-xl);
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.1));
    transition: var(--transition);
}

.hero-image:hover {
    transform: scale(1.02);
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.15));
}

.main-title {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.main-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.main-features {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.feature-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--background-secondary);
    padding: 0.75rem 1.25rem;
    border-radius: var(--border-radius-lg);
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.feature-badge:hover {
    background: var(--background-tertiary);
    border-color: var(--border-hover);
}

.feature-icon {
    font-size: 1rem;
}

.main-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1.25rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    margin-bottom: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.main-button:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.button-icon {
    font-size: 1.1rem;
    transition: var(--transition);
}

.main-button:hover .button-icon {
    transform: translateX(2px);
}

.main-note {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Participant Counter */
.participant-counter-text {
    text-align: center;
    color: var(--text-primary);
    font-size: 1rem;
    margin: 1.5rem 0 2rem;
    font-weight: 600;
}

.participant-counter-text strong {
    color: #3b82f6;
    font-weight: 700;
    font-size: 1.3rem;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(59, 130, 246, 0.2);
}

/* 카운트 업 애니메이션 */
.count-up {
    animation: countUp 0.6s ease-out;
}

@keyframes countUp {
    0% {
        transform: scale(1);
        color: var(--primary-color);
    }
    50% {
        transform: scale(1.1);
        color: var(--accent-color);
    }
    100% {
        transform: scale(1);
        color: var(--primary-color);
    }
}

/* Test Screen */
.test-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 2rem;
}

.progress-section {
    margin-bottom: 2rem;
}

.progress-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
}

.progress-separator {
    color: var(--text-secondary);
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--background-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.question-section {
    margin-bottom: 2rem;
}

.question-card {
    background: var(--background-primary);
    padding: 2rem;
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    animation: slideInUp 0.4s ease;
}

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

.question-text {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 2rem;
    text-align: center;
    font-weight: 600;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.option-btn {
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-color);
    background: var(--background-primary);
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    color: var(--text-primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.option-btn:hover {
    border-color: var(--primary-color);
    background: var(--background-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.option-btn.selected {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.navigation-section {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.nav-button {
    padding: 0.875rem 1.5rem;
    border: 1px solid var(--border-color);
    background: var(--background-primary);
    color: var(--text-primary);
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
}

.nav-button:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--background-secondary);
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.prev-button {
    justify-content: flex-start;
}

.next-button {
    justify-content: flex-end;
}

/* Result Screen */
.result-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* 결과 상단 섹션 (캐릭터 + 정보) */
.result-top-section {
    display: flex;
    gap: 3rem;
    margin-bottom: 3rem;
    background: var(--background-primary);
    border-radius: var(--border-radius-xl);
    padding: 3rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    animation: slideInUp 0.5s ease;
}

.result-character {
    flex: 0 0 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background-secondary);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
}

.result-character .result-emoji {
    width: 250px;
    height: 250px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.5rem;
}

.info-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    letter-spacing: 0.05em;
    width: 100%;
}

.info-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    width: 100%;
    word-break: keep-all;
    line-height: 1.5;
    text-align: left;
}

.info-help {
    font-size: 0.875rem;
    color: var(--text-light);
    cursor: help;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background-secondary);
}

/* 구분선 */
.result-divider {
    text-align: center;
    margin: 3rem 0;
    padding: 2rem 0;
    border-top: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
}

.divider-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

/* 트레이트 카드들 */
.result-traits {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.trait-card {
    background: var(--background-primary);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    text-align: center;
    transition: var(--transition);
    animation: fadeInUp 0.5s ease;
}

.trait-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.trait-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.trait-circle {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 1rem;
}

.trait-progress {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.trait-bg {
    fill: none;
    stroke: var(--background-tertiary);
    stroke-width: 8;
}

.trait-fill {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease;
}

.trait-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.trait-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* 트레이트별 색상 */
.trait-card[data-trait="communication"] .trait-fill {
    stroke: #06b6d4;
}

.trait-card[data-trait="expression"] .trait-fill {
    stroke: #f59e0b;
}

.trait-card[data-trait="planning"] .trait-fill {
    stroke: #10b981;
}

.trait-card[data-trait="approach"] .trait-fill {
    stroke: #a855f7;
}

.trait-card[data-trait="style"] .trait-fill {
    stroke: #6366f1;
}

/* 반응형 스타일 */
@media (max-width: 768px) {
    .result-top-section {
        flex-direction: column;
        padding: 2rem 1.5rem;
    }

    .result-character {
        flex: 0 0 auto;
    }

    .result-character .result-emoji {
        width: 200px;
        height: 200px;
    }

    .result-info {
        gap: 1rem;
    }

    .info-row {
        flex-wrap: wrap;
    }

    .info-label {
        min-width: 80px;
        font-size: 0.75rem;
    }

    .info-value {
        font-size: 1rem;
    }

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

    .trait-circle {
        width: 100px;
        height: 100px;
    }

    .trait-percentage {
        font-size: 1.25rem;
    }
    
    .result-actions {
        flex-direction: column;
        gap: 0.875rem;
        padding: 0 0.5rem;
    }
    
    .action-button {
        width: 100%;
        max-width: 300px;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .result-container {
        padding: 1rem;
    }
    
    .result-actions {
        gap: 0.75rem;
        padding: 0;
    }
    
    .action-button {
        padding: 0.875rem 1.5rem;
        font-size: 0.875rem;
        min-width: auto;
    }

    .result-top-section {
        padding: 1.5rem 1rem;
    }

    .result-character .result-emoji {
        width: 150px;
        height: 150px;
    }

    .result-traits {
        grid-template-columns: 1fr;
    }
}

/* 기존 스타일 유지 */
.result-card {
    background: var(--background-primary);
    border-radius: var(--border-radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    animation: slideInUp 0.5s ease;
}

.result-header {
    text-align: center;
    margin-bottom: 2rem;
}

.result-emoji {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.result-title {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.result-type {
    font-size: 2.2rem;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 1rem;
}

.result-content {
    text-align: left;
}

.result-description {
    background: var(--background-secondary);
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    margin-bottom: 1.5rem;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.result-tips, .result-compatibility {
    margin-bottom: 1.5rem;
}

.result-tips h4, .result-compatibility h4 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

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

.result-tips li {
    background: var(--background-primary);
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: var(--border-radius-lg);
    border-left: 3px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.result-tips li:hover {
    background: var(--background-secondary);
}

.compatibility-types {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.compat-type {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-lg);
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}

.compat-type:hover {
    background: var(--primary-hover);
}

.result-actions {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 0 1rem;
    flex-wrap: wrap;
}

.action-button {
    padding: 1rem 2rem;
    border: none;
    background: var(--background-primary);
    color: var(--text-primary);
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
    min-width: 140px;
}

.action-button .button-icon {
    font-size: 1.1rem;
}

.share-button {
    background: var(--primary-color);
    color: white;
}

.download-button {
    background: var(--accent-color);
    color: white;
}

.retake-button {
    background: var(--text-secondary);
    color: white;
}

.action-button:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.share-button:hover {
    background: var(--primary-hover);
}

.download-button:hover {
    background: #d97706;
}

.retake-button:hover {
    background: #475569;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--background-primary);
    border-radius: var(--border-radius-xl);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    animation: slideInUp 0.3s ease;
}

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

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--background-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.share-btn-twitter, .share-btn-kakao, .share-btn-facebook, .share-btn-copy {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: var(--background-primary);
    color: var(--text-primary);
}

.share-btn-twitter:hover {
    background: #1da1f2;
    color: white;
    border-color: #1da1f2;
}

.share-btn-kakao:hover {
    background: #fee500;
    color: #3c1e1e;
    border-color: #fee500;
}

.share-btn-facebook:hover {
    background: #1877f2;
    color: white;
    border-color: #1877f2;
}

.share-btn-copy:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

.share-text {
    font-size: 0.85rem;
}

/* Footer */
.footer {
    background: var(--background-primary);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    text-align: center;
}

.footer-links {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-color);
}

.footer-copyright {
    color: var(--text-light);
    font-size: 0.85rem;
}

/* Ad Container */
.ad-container {
    width: 100%;
    margin: 2rem 0;
    display: flex;
    justify-content: center;
}

.ad-container.ad-top {
    margin-top: 0;
    margin-bottom: 2rem;
}

.ad-placeholder {
    background: var(--background-secondary);
    border: 2px dashed var(--border-color);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    text-align: center;
    color: var(--text-secondary);
    min-width: 300px;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

/* Personality Types Section - 인터랙티브 디자인 */
.personality-types {
    padding: 40px 20px;
    margin: 20px auto;
    max-width: 1200px;
}

.section-title {
    text-align: center;
    margin-bottom: 15px;
    font-size: 28px;
    color: #333;
}

.types-description {
    text-align: center;
    margin-bottom: 40px;
    font-size: 16px;
    color: #666;
    font-style: italic;
}

/* 케미 유형 설명 섹션 - 텍스트 기반 카드 디자인 */
.type-description-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    box-sizing: border-box;
}

.type-description-card {
    background: var(--background-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.type-description-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

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

.type-card-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    object-position: center;
    flex-shrink: 0;
}

.type-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.type-card-description {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin: 0;
    flex-grow: 1;
}

.type-card-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s ease;
    margin-top: auto;
}

.type-card-link:hover {
    color: var(--primary-hover);
    gap: 0.5rem;
}

/* 태블릿 이상에서는 2열 */
@media (min-width: 768px) {
    .type-description-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
        padding: 0 2rem;
    }
    
    .type-description-card {
        padding: 2rem;
    }
}

/* 데스크탑에서는 3열 */
@media (min-width: 1024px) {
    .type-description-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.chemistry-results {
    background: var(--background-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    animation: fadeInUp 0.5s ease;
    margin-top: 1.5rem;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
    font-size: 20px;
    font-weight: 700;
}

.selected-type {
    display: flex;
    align-items: center;
    gap: 8px;
}

.selected-emoji {
    font-size: 24px;
}

.selected-name {
    color: var(--text-primary);
    font-weight: 600;
}

.results-title {
    color: var(--text-secondary);
    font-weight: 600;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.result-card {
    background: var(--background-primary);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 160px;
    box-shadow: var(--shadow-sm);
}

.result-card:hover {
    background: var(--background-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.result-pair {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 10px;
    text-align: center;
}

.result-emoji {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 0.5rem;
}

/* 로맨틱형 이미지 크기 증가 */
.result-card[data-type="romantic"] .result-emoji,
.results-grid [data-type="romantic"] .result-emoji {
    width: 130px;
    height: 130px;
}

/* 결과 페이지 resultEmoji 스타일 */
#resultEmoji {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin-bottom: 1rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: width 0.3s ease, height 0.3s ease;
}

/* 결과 페이지에서 로맨틱형 이미지 크기 증가 */
#resultScreen #resultEmoji.romantic-size {
    width: 120px;
    height: 120px;
}

.result-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.result-x {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.result-score {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.result-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
    text-align: center;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.5rem;
}

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


/* 전역 안전 설정 */
html, body {
    box-sizing: border-box;
}
*, *:before, *:after { box-sizing: inherit; }

/* 그리드 컨테이너 - 가로 2줄 레이아웃으로 변경 */
.types-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr); /* 6열로 고정 */
    grid-template-rows: repeat(2, 1fr); /* 2행으로 고정 */
    gap: 20px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    justify-items: center;
    align-items: center;
}

/* 카드 크기/정렬 조정 - 가로 2줄 레이아웃에 맞게 최적화 */
.type-box {
    width: 100%;
    max-width: 180px;
    min-height: 80px;
    padding: 16px 12px;
    text-align: center;
    font-size: 15px;
    line-height: 1.3;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
    border: 1px solid #f0f0f0;
}

.type-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #e0e0e0;
}


/* 가로 스크롤 방지 - 전역 설정 */
html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    position: relative;
}

/* 모바일 반응형 - 유형 설명 섹션 */
@media (max-width: 480px) {
    .type-description-grid {
        padding: 0 0.75rem;
        gap: 1rem;
    }
    
    .type-description-card {
        padding: 1.25rem;
    }
    
    .type-card-image {
        width: 60px;
        height: 60px;
    }
    
    .type-card-header {
        gap: 0.75rem;
    }
    
    .type-card-title {
        font-size: 1.125rem;
    }
    
    .type-card-description {
        font-size: 0.875rem;
        line-height: 1.6;
    }
    
    .type-card-link {
        font-size: 0.8125rem;
    }
}

/* 반응형 디자인 개선 - 중복 제거 */
@media (max-width: 768px) {
    .header-content {
        padding: 1rem;
    }
    
    .main-title {
        font-size: 2rem;
    }

    .hero-image-container {
        max-width: 300px;
        margin-bottom: 2rem;
    }
    
    .main-description {
        font-size: 1rem;
    }
    
    .main-features {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    .question-card {
        padding: 1.5rem;
    }
    
    .question-text {
        font-size: 1.2rem;
    }
    
    .result-card {
        padding: 1.5rem;
    }
    
    .result-type {
        font-size: 1.8rem;
    }
    
    .share-buttons {
        grid-template-columns: 1fr;
    }
    
    .footer-links {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem;
    }
}

@media (min-width: 769px) {
    .result-actions {
        flex-direction: row;
        gap: 1.25rem;
    }
    
    .action-button {
        min-width: 160px;
        padding: 1.125rem 2.25rem;
    }
    
    .share-buttons {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 모바일 최적화 - 텍스트 짤림 방지 */
@media (max-width: 480px) {
    * {
        box-sizing: border-box;
    }
    
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }
    
    body {
        font-size: 14px;
        word-break: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    .main-content {
        padding-top: 90px !important;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        padding-bottom: 0;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    /* 홈 화면이 제대로 보이도록 - 헤더 아래부터 시작 */
    #homeScreen {
        padding-top: 0 !important;
        margin-top: 0 !important;
    }
    
    #homeScreen .main-container {
        padding-top: 1rem !important;
        margin-top: 0 !important;
    }
    
    /* 메인 타이틀이 잘리지 않도록 */
    #homeScreen .main-title {
        margin-top: 0 !important;
        padding-top: 0.5rem !important;
    }
    
    .screen {
        padding: 0 !important;
        min-height: auto !important;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    /* 홈 화면은 헤더 아래부터 시작하도록 */
    #homeScreen.screen {
        padding-top: 0 !important;
        margin-top: 0 !important;
    }
    
    .main-container, .test-container, .result-container {
        width: 100%;
        max-width: 100vw;
        padding-left: 1rem;
        padding-right: 1rem;
        padding-top: 0.5rem;
        padding-bottom: 0 !important;
        box-sizing: border-box;
        margin-bottom: 0 !important;
    }
    
    /* 결과 화면 모바일 최적화 - 간격 더 줄이기 */
    #resultScreen .result-container {
        padding: 0.5rem !important;
        padding-bottom: 0 !important;
    }
    
    #resultScreen .result-top-section {
        padding: 0.75rem !important;
        margin-bottom: 0.75rem !important;
        gap: 0.75rem !important;
        flex-direction: column;
    }
    
    #resultScreen .result-character {
        flex: 0 0 auto;
        padding: 0.75rem !important;
    }
    
    #resultScreen .result-character .result-emoji {
        width: 120px !important;
        height: 120px !important;
    }
    
    #resultScreen .result-info {
        gap: 0.5rem !important;
    }
    
    #resultScreen .info-row {
        gap: 0.25rem !important;
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    #resultScreen .info-label {
        font-size: 0.75rem !important;
        width: 100% !important;
        text-align: left !important;
    }
    
    #resultScreen .info-value {
        font-size: 1rem !important;
        width: 100% !important;
        word-break: keep-all !important;
        line-height: 1.5 !important;
        text-align: left !important;
    }
    
    #resultScreen .result-divider {
        margin: 0.75rem 0 !important;
        padding: 0.75rem 0 !important;
    }
    
    #resultScreen .divider-title {
        font-size: 1.1rem !important;
    }
    
    /* 트레이트 카드 레이아웃 완전히 변경 - 모바일 친화적 */
    #resultScreen .result-traits {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    #resultScreen .trait-card {
        padding: 0.75rem !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 1rem !important;
        text-align: left !important;
        border-radius: var(--border-radius) !important;
    }
    
    #resultScreen .trait-header {
        font-size: 0.8rem !important;
        margin-bottom: 0 !important;
        min-width: 80px !important;
        flex-shrink: 0;
    }
    
    #resultScreen .trait-circle {
        width: 60px !important;
        height: 60px !important;
        margin: 0 !important;
        flex-shrink: 0;
    }
    
    #resultScreen .trait-percentage {
        font-size: 0.75rem !important;
    }
    
    #resultScreen .trait-label {
        font-size: 0.7rem !important;
        margin-top: 0 !important;
        flex: 1;
        text-align: right;
    }
    
    #resultScreen .result-actions {
        margin-top: 0.75rem !important;
        margin-bottom: 1rem !important;
        gap: 0.5rem !important;
        flex-direction: column !important;
    }
    
    #resultScreen .action-button {
        padding: 0.75rem 1rem !important;
        font-size: 0.875rem !important;
        width: 100% !important;
        min-width: auto !important;
    }
    
    /* 결과 화면이 활성화되어 있을 때 푸터 간격 */
    #resultScreen.active ~ .footer,
    body:has(#resultScreen.active) .footer {
        padding-top: 0.25rem !important;
        margin-top: 0 !important;
    }
    
    body:has(#resultScreen.active) .footer-content {
        padding-top: 0.25rem !important;
        padding-bottom: 0.5rem !important;
    }
    
    /* 테스트 화면 모바일 최적화 - 간격 완전 제거 */
    #testScreen {
        padding: 0.5rem 0 0 0 !important;
        min-height: auto !important;
    }
    
    #testScreen .test-container {
        padding-top: 0.5rem !important;
        padding-bottom: 0 !important;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        margin-bottom: 0 !important;
    }
    
    .progress-section {
        margin-bottom: 0.75rem;
        padding: 0;
    }
    
    .question-section {
        margin-bottom: 0.75rem;
        padding: 0;
    }
    
    .question-card {
        padding: 1rem 0.75rem;
        margin-bottom: 0;
    }
    
    .question-text {
        margin-bottom: 1rem !important;
        font-size: 1rem !important;
        padding: 0;
    }
    
    .options-container {
        gap: 0.5rem;
    }
    
    .option-btn {
        padding: 0.875rem 0.75rem !important;
        min-height: 50px;
    }
    
    #testScreen .navigation-section {
        margin-top: 0.5rem !important;
        margin-bottom: 0 !important;
        padding: 0 !important;
        padding-bottom: 0 !important;
        gap: 0.75rem;
    }
    
    .nav-button {
        padding: 0.75rem 1rem !important;
        font-size: 0.875rem !important;
    }
    
    /* 푸터와의 간격 완전 제거 */
    .main-content {
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }
    
    /* 테스트 화면이 활성화되어 있을 때 푸터 간격 제거 */
    body:has(#testScreen.active) .footer,
    .footer {
        padding-top: 0.15rem !important;
        padding-bottom: 0.5rem !important;
        margin-top: 0 !important;
    }
    
    .footer-content {
        padding-top: 0.15rem !important;
        padding-bottom: 0.5rem !important;
    }
    
    /* 테스트 화면의 모든 하단 여백 제거 */
    #testScreen.active {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    #testScreen.active .test-container {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    #testScreen.active .navigation-section {
        margin-bottom: 2.5rem !important;
        padding-bottom: 0 !important;
    }
    
    /* 푸터와의 간격 자연스럽게 - 웹처럼 보이게 */
    .footer {
        padding-top: 2rem !important;
        padding-bottom: 1rem !important;
        margin-top: 0 !important;
    }
    
    .footer-content {
        padding-top: 1rem !important;
        padding-bottom: 0.75rem !important;
    }
    
    /* 테스트 화면 하단 여백 추가 */
    #testScreen.active {
        padding-bottom: 1rem !important;
    }
    
    #testScreen.active .test-container {
        padding-bottom: 1rem !important;
    }
    
    .main-title {
        font-size: 1.5rem !important;
        word-wrap: break-word;
        white-space: normal;
        padding: 0 0.5rem;
    }
    
    .main-description {
        font-size: 0.9rem !important;
        word-wrap: break-word;
        padding: 0 0.5rem;
    }
    
    .button, .btn, .main-button {
        padding: 0.75rem 1rem !important;
        font-size: 0.875rem !important;
        min-width: auto;
        width: calc(100% - 2rem);
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }
    
    .main-button {
        justify-content: center !important;
        text-align: center !important;
    }
    
    .main-button .button-text,
    .main-button .button-icon {
        flex: 0 0 auto;
    }
    
    .question-text {
        font-size: 1rem !important;
        word-wrap: break-word;
        white-space: normal;
        padding: 0 0.5rem;
    }
    
    .options-container {
        width: 100%;
        max-width: 100%;
    }
    
    .option-btn {
        width: 100% !important;
        padding: 1rem !important;
        box-sizing: border-box;
    }
    
    .result-type {
        font-size: 1.5rem !important;
        word-wrap: break-word;
    }
    
    .result-description {
        font-size: 0.875rem !important;
        line-height: 1.5;
        word-wrap: break-word;
    }
    
    .result-tips {
        font-size: 0.85rem !important;
        padding-left: 1.25rem;
    }
    
    .share-buttons {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem;
    }
    
    .share-btn {
        padding: 0.75rem 0.5rem !important;
        font-size: 0.75rem !important;
    }
    
    /* 헤더 최적화 */
    .header {
        padding: 0.75rem 0.5rem;
        width: 100%;
        max-width: 100vw;
    }
    
    .header-content {
        width: 100%;
        max-width: 100vw;
        padding: 0.75rem 1rem;
        box-sizing: border-box;
    }
    
    .header-logo h1 {
        font-size: 1rem;
    }
    
    .lang-btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
        min-width: auto;
        white-space: nowrap !important;
    }
    
    .lang-text {
        white-space: nowrap !important;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .lang-dropdown {
        min-width: 100%;
    }
    
    .lang-option {
        white-space: nowrap !important;
        padding: 0.625rem 0.75rem !important;
    }
    
    .lang-name {
        white-space: nowrap !important;
        font-size: 0.8rem !important;
    }
    
    
    .results-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
        width: 100%;
        max-width: 100%;
    }
    
    /* 푸터 최적화 */
    .footer {
        padding: 1rem 0.5rem;
        width: 100%;
        max-width: 100vw;
    }
    
    .footer-content {
        width: 100%;
        max-width: 100vw;
        padding: 1rem;
        box-sizing: border-box;
    }
    
    .footer-links {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 0.75rem !important;
    }
    
    .footer-links a {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        white-space: nowrap;
    }
    
    /* 모달 최적화 */
    .modal {
        padding: 1rem;
    }
    
    .modal-content {
        max-width: 95vw;
        padding: 1rem;
        width: calc(100vw - 2rem);
    }
    
    .close-btn {
        top: 0.5rem;
        right: 0.5rem;
    }
}

@media (max-width: 360px) {
    .main-title {
        font-size: 1.25rem !important;
    }
    
    .button, .btn {
        font-size: 0.75rem !important;
        padding: 0.5rem !important;
    }
    
    .lang-text {
        display: none;
    }
    
    
    .results-grid {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    .header, .footer, .modal {
        display: none !important;
    }
    
    .main-content {
        padding-top: 0;
    }
    
    .screen {
        display: block !important;
    }
}