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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 20px;
}

.screen {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    display: none;
    animation: slideIn 0.3s ease-out;
}

.screen.active {
    display: block;
}

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

/* 시작 화면 스타일 */
#start-screen header {
    text-align: center;
    margin-bottom: 40px;
}

#start-screen h1 {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 10px;
}

#start-screen p {
    font-size: 1.2em;
    color: #666;
}

.topic-selection h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

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

.topic-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.topic-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.topic-btn.selected {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    transform: scale(1.05);
}

.topic-btn .icon {
    font-size: 2em;
}

.topic-btn .name {
    font-weight: bold;
    font-size: 1.1em;
}

.difficulty-selection {
    text-align: center;
    margin-bottom: 30px;
}

.difficulty-selection h3 {
    margin-bottom: 20px;
    color: #333;
}

.difficulty-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.difficulty-btn {
    background: #f0f0f0;
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.difficulty-btn:hover {
    background: #e0e0e0;
}

.difficulty-btn.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.primary-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 0 auto;
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 퀴즈 화면 스타일 */
#quiz-screen header {
    margin-bottom: 30px;
}

.progress-bar {
    background: #f0f0f0;
    height: 8px;
    border-radius: 4px;
    margin-bottom: 15px;
    overflow: hidden;
}

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

.quiz-info {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    color: #666;
}

.question-container {
    text-align: center;
    margin-bottom: 40px;
}

#question-text {
    font-size: 1.4em;
    margin-bottom: 20px;
    color: #333;
    line-height: 1.6;
}

.question-image {
    max-width: 100%;
    height: 200px;
    background: #f0f0f0;
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 3em;
    color: #999;
}

.answers-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.answer-btn {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-size: 1.1em;
}

.answer-btn:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.answer-btn.correct {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.answer-btn.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.quiz-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.secondary-btn {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.secondary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 결과 화면 스타일 */
#result-screen header {
    text-align: center;
    margin-bottom: 40px;
}

#result-screen h1 {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 10px;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-item {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
}

.stat-item .label {
    display: block;
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.stat-item .value {
    display: block;
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
}

.performance-message {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px;
    border-radius: 10px;
    font-size: 1.2em;
    font-weight: bold;
}

.performance-message.excellent {
    background: #d4edda;
    color: #155724;
}

.performance-message.good {
    background: #cce5ff;
    color: #004085;
}

.performance-message.average {
    background: #fff3cd;
    color: #856404;
}

.performance-message.poor {
    background: #f8d7da;
    color: #721c24;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        margin: 10px;
    }
    
    .screen {
        padding: 20px;
    }
    
    #start-screen h1 {
        font-size: 2em;
    }
    
    .topic-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .difficulty-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    #question-text {
        font-size: 1.2em;
    }
    
    .quiz-controls {
        flex-direction: column;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .primary-btn,
    .secondary-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .topic-grid {
        grid-template-columns: 1fr;
    }
    
    .result-stats {
        grid-template-columns: 1fr;
    }
}