/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', 'Noto Sans JP', 'Noto Sans SC', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Language Selector */
.language-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

#languageSelect {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

#languageSelect:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

/* Screen Management */
.screen {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.screen.active {
    display: block;
}

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

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: 700;
}

.header p {
    font-size: 1.2em;
    opacity: 0.9;
    font-weight: 300;
}

/* Main Content */
.main-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

/* Quiz Info */
.quiz-info {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 40px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #666;
    font-weight: 500;
}

.info-item i {
    color: #667eea;
    font-size: 1.2em;
}

/* Start Button */
.start-button {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0 auto 40px auto;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.3em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.start-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.start-button:active {
    transform: translateY(-1px);
}

/* Character Preview */
.character-preview h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5em;
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.character-item {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 15px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.character-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.9);
    border-color: #667eea;
}

.character-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    margin: 0 auto 15px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    color: white;
    font-weight: bold;
}

.character-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.character-trait {
    font-size: 0.9em;
    color: #666;
    font-style: italic;
}

/* Quiz Screen */
.quiz-header {
    margin-bottom: 40px;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 15px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    font-weight: 600;
    color: #667eea;
    min-width: 60px;
}

/* Question Container */
.question-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
}

.question-number {
    color: #667eea;
    font-weight: 600;
    font-size: 1.1em;
    margin-bottom: 15px;
}

.question-title {
    font-size: 1.8em;
    margin-bottom: 30px;
    color: #333;
    font-weight: 600;
    line-height: 1.4;
}

/* Answers */
.answers {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.answer-option {
    padding: 20px;
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: manipulation;
}

.answer-option:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
    transform: translateX(5px);
}

.answer-option.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.answer-letter {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.answer-option.selected .answer-letter {
    background: rgba(255, 255, 255, 0.3);
}

/* Result Screen */
.result-header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.result-header h2 {
    font-size: 2.2em;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.result-character {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
}

.result-avatar {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    margin: 0 auto 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
    color: white;
    font-weight: bold;
}

.result-character-name {
    font-size: 2em;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.result-character-trait {
    font-size: 1.2em;
    color: #667eea;
    font-weight: 600;
    margin-bottom: 20px;
}

.result-character-description {
    font-size: 1.1em;
    color: #666;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

/* Result Details */
.result-details {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
}

.detail-section {
    margin-bottom: 30px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-title {
    font-size: 1.5em;
    color: #333;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-content {
    color: #666;
    line-height: 1.6;
    font-size: 1.1em;
}

.trait-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.trait-tag {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
}

.compatibility-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.compatibility-item {
    background: rgba(102, 126, 234, 0.1);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
}

.compatibility-character {
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.compatibility-description {
    font-size: 0.9em;
    color: #666;
}

/* Result Actions */
.result-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.action-button {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
    justify-content: center;
}

.share-btn {
    background: #1DA1F2;
    color: white;
}

.share-btn:hover {
    background: #0d8bd9;
    transform: translateY(-2px);
}

.retake-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    border: 2px solid #667eea;
}

.retake-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(102, 126, 234, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-screen.active {
    display: flex;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
}

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

.loading-content p {
    font-size: 1.3em;
    font-weight: 500;
}

/* Ad Containers */
.ad-container {
    margin: 30px 0;
    text-align: center;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-ad {
    margin-bottom: 20px;
}

.side-ad {
    margin-top: 20px;
}

.bottom-ad {
    margin-top: 40px;
    margin-bottom: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .main-content,
    .question-container,
    .result-details,
    .result-character {
        padding: 25px;
    }
    
    .quiz-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .character-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .progress-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .question-title {
        font-size: 1.4em;
    }
    
    .answer-option {
        padding: 18px;
        font-size: 16px; /* Prevent zoom on iOS */
        min-height: 60px; /* Larger touch target */
    }
    
    .answer-option:active {
        transform: scale(0.98);
        background: rgba(102, 126, 234, 0.15);
    }
    
    .result-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .action-button {
        width: 100%;
        max-width: 280px;
    }
    
    .compatibility-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .language-selector {
        top: 10px;
        right: 10px;
    }
    
    .header h1 {
        font-size: 1.8em;
    }
    
    .character-grid {
        grid-template-columns: 1fr;
    }
    
    .answer-option {
        padding: 20px;
        min-height: 65px;
        font-size: 16px;
    }
    
    .answer-letter {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .character-avatar {
        width: 60px;
        height: 60px;
        font-size: 1.5em;
    }
    
    .result-avatar {
        width: 100px;
        height: 100px;
        font-size: 2.5em;
    }
    
    .result-character-name {
        font-size: 1.6em;
    }
}
