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

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

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

.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

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

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

.quiz-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    flex: 1;
}

.screen {
    display: none;
    padding: 40px;
    min-height: 500px;
}

.screen.active {
    display: block;
}

/* 시작 화면 */
.start-content {
    text-align: center;
}

.start-content h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    color: #333;
}

.quiz-settings {
    margin-bottom: 30px;
}

.quiz-settings h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #555;
}

.setting-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px 0;
}

.setting-group label {
    font-weight: 500;
    color: #555;
}

.setting-group select {
    padding: 8px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
}

.start-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.view-all-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
    margin-top: 15px;
}

.view-all-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.6);
}

/* 퀴즈 화면 */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    flex-wrap: nowrap;
    gap: 20px;
}

.quiz-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.home-from-quiz-btn {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(108, 117, 125, 0.3);
}

.home-from-quiz-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.5);
}

.progress-info, .score-info {
    font-size: 1.1rem;
    font-weight: 600;
    color: #555;
    white-space: nowrap !important;
    min-width: fit-content;
    display: inline-block;
    line-height: 1;
}

.progress-info span {
    display: inline;
    white-space: nowrap;
}

.timer-container {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    min-width: fit-content;
}

.timer {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 3px 10px rgba(255, 107, 107, 0.3);
}

.pause-resume-btn {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(108, 117, 125, 0.3);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pause-resume-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.5);
}

.pause-resume-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.answer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.auto-next-timer-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auto-next-timer {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 6px 15px;
    border-radius: 15px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.auto-next-timer.disabled {
    background: #6c757d;
    opacity: 0.6;
}

.question-container {
    margin-bottom: 30px;
}

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

.category-tag, .subcategory-tag {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-right: 10px;
}

.category-tag {
    background: #667eea;
    color: white;
}

.subcategory-tag {
    background: #764ba2;
    color: white;
}

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

.answer-container {
    margin-top: 30px;
}

.answer-input {
    width: 100%;
    min-height: 120px;
    padding: 20px;
    border: 3px solid #e0e0e0;
    border-radius: 15px;
    font-size: 1.1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.answer-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.answer-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.submit-btn, .skip-btn, .show-answer-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.show-answer-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.show-answer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.6);
}

.skip-btn {
    background: #f8f9fa;
    color: #6c757d;
    border: 2px solid #dee2e6;
}

.skip-btn:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

/* 답변 표시 영역 */
.answer-display {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #e0f8e9 0%, #b2f2d7 100%);
    border-radius: 15px;
    border-left: 5px solid #28a745;
    animation: slideDown 0.3s ease-out;
}

.answer-display.hidden {
    display: none;
}

.answer-display h3 {
    color: #218838;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.answer-display p {
    color: #333;
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0;
}

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

/* 결과 화면 */
.result-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.result-content h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

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

.stat-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
}

.result-details {
    margin-bottom: 30px;
}

.result-details h3 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #555;
}

.question-results {
    max-height: 500px;
    overflow-y: auto;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    padding: 20px;
    background: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.question-result {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 12px;
    border-left: 5px solid #667eea;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.question-result:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.question-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.question-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.question-category {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 6px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

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

.question-content p {
    margin-bottom: 12px;
    line-height: 1.6;
    font-size: 1rem;
}

.question-content strong {
    color: #495057;
    font-weight: 600;
}

.question-content p:first-child {
    color: #333;
    font-weight: 500;
}

.question-content p:last-child {
    color: #28a745;
    font-weight: 600;
    background: rgba(40, 167, 69, 0.1);
    padding: 10px 15px;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.result-status {
    display: flex;
    align-items: center;
    min-width: 80px;
}

.status {
    font-weight: 600;
    font-size: 0.9rem;
}

.result-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

.retry-btn, .home-btn {
    padding: 15px 40px;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.retry-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.retry-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.home-btn {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

.home-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.6);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .screen {
        padding: 20px;
    }
    
    .quiz-header {
        flex-direction: row;
        gap: 10px;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 15px;
    }
    
    .progress-info, .score-info {
        font-size: 1rem;
        min-width: auto;
    }
    
    .timer-container {
        gap: 8px;
        min-width: auto;
    }
    
    .timer {
        padding: 6px 15px;
        font-size: 1rem;
    }
    
    .pause-resume-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .result-stats {
        grid-template-columns: 1fr;
    }
    
    .answer-buttons {
        flex-direction: column;
    }
    
    .result-buttons {
        flex-direction: column;
    }
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.screen.active {
    animation: fadeIn 0.5s ease-out;
}

/* 스크롤바 스타일 */
.question-results::-webkit-scrollbar {
    width: 10px;
}

.question-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

.question-results::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
}

.question-results::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

/* 진행 상황 표시 스타일 (결과 화면용) */
.result-progress-info {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.progress-stat {
    text-align: center;
    flex: 1;
}

.progress-label {
    display: block;
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 5px;
}

.progress-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: #495057;
}

/* 모든 문제 다시 풀기 버튼 스타일 */
.reset-all-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
    margin-top: 20px;
}

.reset-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.6);
}

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

/* 결과 버튼 컨테이너 개선 */
.result-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 30px;
}

/* 반응형 디자인 개선 */
@media (max-width: 768px) {
    .result-progress-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .progress-stat {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .progress-label {
        margin-bottom: 0;
    }
    
    .result-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .reset-all-btn {
        width: 100%;
        max-width: 300px;
    }
}

/* 전체 문제 보기 화면 */
.all-questions-content {
    max-width: 800px;
    margin: 0 auto;
}

.all-questions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    flex-wrap: wrap;
    gap: 15px;
}

.title-section {
    display: flex;
    align-items: baseline;
    gap: 15px;
}

.all-questions-header h2 {
    font-size: 2rem;
    color: #333;
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.total-questions-count {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 5px 12px;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #dee2e6;
}

.total-questions-count span {
    font-weight: 700;
    color: #667eea;
}

.auto-scroll-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 10px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    flex-wrap: wrap;
}

.auto-scroll-controls label {
    font-weight: 600;
    color: #555;
    margin: 0;
}

.auto-scroll-controls input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #28a745;
}

.auto-scroll-controls select {
    padding: 5px 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    color: #555;
}

.auto-scroll-status {
    font-weight: 600;
    color: #28a745;
    min-width: 30px;
}

.all-questions-list {
    max-height: 600px;
    overflow-y: auto;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    padding: 20px;
    background: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.all-question-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 12px;
    border-left: 5px solid #667eea;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.all-question-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.all-question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.all-question-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.all-question-category {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 6px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.all-question-content {
    text-align: left;
}

.all-question-content p {
    margin-bottom: 12px;
    line-height: 1.6;
    font-size: 1rem;
}

.all-question-content strong {
    color: #495057;
    font-weight: 600;
}

.all-question-content p:first-child {
    color: #333;
    font-weight: 500;
}

.all-question-content p:last-child {
    color: #28a745;
    font-weight: 600;
    background: rgba(40, 167, 69, 0.1);
    padding: 10px 15px;
    border-radius: 8px;
    border-left: 4px solid #28a745;
} 