/* 퀴즈 게임 플러그인 CSS */

/* 전체 화면 모드 */
.quiz-game-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: linear-gradient(135deg, #87CEEB 0%, #98FB98 25%, #F0E68C 50%, #DDA0DD 75%, #FFB6C1 100%);
    overflow: hidden;
}

.quiz-game-fullscreen #quiz-game-app {
    align-items: center;
    height: 100%;
}

.quiz-game-fullscreen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

/* 기본 컨테이너 */
#quiz-game-container {
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#quiz-game-container:not(.quiz-game-fullscreen) {
    background: linear-gradient(135deg, #87CEEB 0%, #98FB98 25%, #F0E68C 50%, #DDA0DD 75%, #FFB6C1 100%);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

/* 게임 앱 컨테이너 */
#quiz-game-app {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

/* 카드 스타일 */
.quiz-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 32px;
    width: 100%;
    max-width: 600px;
    position: relative;
    overflow: hidden;
}

.quiz-card-header {
    text-align: center;
    margin-bottom: 24px;
}

.quiz-card-title {
    font-size: 2rem;
    font-weight: bold;
    color: #1a1a1a;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.quiz-card-subtitle {
    color: #666;
    margin: 0;
    font-size: 1rem;
}

/* 버튼 스타일 */
.quiz-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #3b82f6;
    color: white;
    min-height: 48px;
}

.quiz-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

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

.quiz-btn-primary {
    background: #3b82f6;
    color: white;
}

.quiz-btn-secondary {
    background: #6b7280;
    color: white;
}

.quiz-btn-outline {
    background: transparent;
    color: #3b82f6;
    border-color: #3b82f6;
}

.quiz-btn-destructive {
    background: #dc2626;
    color: white;
}

.quiz-btn-success {
    background: #10b981;
    color: white;
}

.quiz-btn-large {
    padding: 16px 32px;
    font-size: 1.125rem;
}

.quiz-btn-full {
    width: 100%;
}

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

/* 배지 스타일 */
.quiz-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    background: #e5e7eb;
    color: #374151;
}

.quiz-badge-primary {
    background: #dbeafe;
    color: #1d4ed8;
}

.quiz-badge-secondary {
    background: #f3f4f6;
    color: #4b5563;
}

.quiz-badge-success {
    background: #d1fae5;
    color: #047857;
}

.quiz-badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.quiz-badge-danger {
    background: #fee2e2;
    color: #dc2626;
}

/* 프로그레스 바 */
.quiz-progress {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.quiz-progress-bar {
    height: 100%;
    background: #3b82f6;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.quiz-progress-time {
    background: #10b981;
}

.quiz-progress-time.danger {
    background: #dc2626;
}

/* 입력 필드 */
.quiz-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    background: white;
}

.quiz-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 아바타 스타일 */
.quiz-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.quiz-avatar:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.quiz-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.quiz-avatar i {
    color: white;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.quiz-avatar-small {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}

.quiz-avatar-large {
    width: 96px;
    height: 96px;
    font-size: 2.5rem;
}

/* 스탯 표시 */
.quiz-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.quiz-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: #6b7280;
}

.quiz-stat-icon {
    width: 16px;
    height: 16px;
}

/* 질문 영역 */
.quiz-question {
    text-align: center;
    margin: 32px 0;
}

.quiz-question-flag {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: pulse 2s infinite;
    color: #6b7280;
}

.quiz-question-flag i {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.quiz-question-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    margin: 16px 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.quiz-question-image:hover {
    transform: scale(1.05);
}

.quiz-question-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.quiz-question-subtitle {
    color: #6b7280;
    font-size: 1rem;
}

.quiz-question-detail {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-top: 4px;
}

/* 선택지 버튼 */
.quiz-options {
    display: grid;
    gap: 12px;
    margin: 24px 0;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: 1rem;
}

.quiz-option:hover {
    border-color: #3b82f6;
    background: #f8fafc;
    transform: translateY(-1px);
}

.quiz-option.selected {
    border-color: #3b82f6;
    background: #dbeafe;
}

.quiz-option.correct {
    border-color: #10b981;
    background: #d1fae5;
    color: #047857;
}

.quiz-option.incorrect {
    border-color: #dc2626;
    background: #fee2e2;
    color: #dc2626;
}

.quiz-option.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.quiz-option-letter {
    font-family: monospace;
    font-weight: bold;
    min-width: 24px;
}

/* 힌트 */
.quiz-hint {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #92400e;
    font-size: 0.875rem;
}

.quiz-hint-icon {
    width: 16px;
    height: 16px;
    color: #f59e0b;
}

/* 결과 표시 */
.quiz-result {
    text-align: center;
    padding: 24px;
    border-radius: 8px;
    background: #f3f4f6;
    margin: 24px 0;
}

.quiz-result.correct {
    background: #d1fae5;
    color: #047857;
}

.quiz-result.incorrect {
    background: #fee2e2;
    color: #dc2626;
}

.quiz-result-emoji {
    font-size: 3rem;
    margin-bottom: 12px;
}

.quiz-result-text {
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.quiz-result-detail {
    font-size: 0.875rem;
    opacity: 0.8;
}

/* 리더보드 */
.quiz-leaderboard {
    overflow-y: auto;
}

.quiz-leaderboard-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 8px;
}

.quiz-leaderboard-item:nth-child(1) { background: #fef3c7; }
.quiz-leaderboard-item:nth-child(2) { background: #e5e7eb; }
.quiz-leaderboard-item:nth-child(3) { background: #fed7aa; }

.quiz-leaderboard-player {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quiz-leaderboard-rank {
    font-size: 1.5rem;
    min-width: 40px;
    text-align: center;
}

.quiz-leaderboard-info {
    flex: 1;
}

.quiz-leaderboard-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.quiz-leaderboard-meta {
    font-size: 0.75rem;
    color: #6b7280;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quiz-leaderboard-score {
    text-align: right;
}

.quiz-leaderboard-points {
    font-weight: bold;
    font-size: 1.125rem;
}

.quiz-leaderboard-percentage {
    font-size: 0.75rem;
    color: #6b7280;
}

/* 탭 */
.quiz-tabs {
    display: flex;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.quiz-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 0.875rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 60px;
}

.quiz-tab.active {
    background: white;
    color: #1f2937;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 아바타 커스터마이징 */
.quiz-avatar-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    overflow-y: auto;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    margin: 16px 0;
    background: #f9fafb;
}

.quiz-avatar-option {
    width: 80px;
    height: 80px;
    border: 3px solid #e5e7eb;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.quiz-avatar-option:hover {
    transform: translateY(-4px) scale(1.05);
    border-color: #3b82f6;
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.2);
}

.quiz-avatar-option.selected {
    border-color: #3b82f6;
    background: #dbeafe;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.quiz-avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.2s ease;
}

.quiz-avatar-option:hover img {
    transform: scale(1.1);
}

.quiz-avatar-option.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: -5px;
    right: -5px;
    background: #3b82f6;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.quiz-color-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 16px 0;
}

.quiz-color-option {
    width: 100%;
    height: 80px;
    border: 3px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.quiz-color-option:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.quiz-color-option.selected {
    border-color: #1f2937;
    box-shadow: 0 0 0 4px rgba(31, 41, 55, 0.2), 0 8px 20px rgba(0,0,0,0.2);
    transform: translateY(-2px);
}

.quiz-color-option.selected::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(2px);
}

/* 애니메이션 */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -30px, 0);
    }
    70% {
        transform: translate3d(0, -15px, 0);
    }
    90% {
        transform: translate3d(0, -4px, 0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

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

.quiz-fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* 로딩 스피너 */
.quiz-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

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

/* 반응형 디자인 */
@media (max-width: 768px) {
    .quiz-card {
        padding: 20px;
        margin: 10px;
    }
    
    .quiz-card-title {
        font-size: 1.5rem;
    }
    
    .quiz-question-flag {
        font-size: 2.5rem;
    }
    
    .quiz-stats {
        justify-content: center;
        gap: 12px;
    }
    
    .quiz-tabs {
        flex-wrap: wrap;
    }
    
    .quiz-tab {
        min-width: auto;
        flex: none;
        padding: 6px 10px;
    }
    
    .quiz-color-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .quiz-color-option {
        height: 60px;
    }
    
    .quiz-avatar-options {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    
    .quiz-avatar-option {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .quiz-card {
        padding: 16px;
    }
    
    .quiz-option {
        padding: 12px;
        font-size: 0.9rem;
    }
    
    .quiz-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .quiz-leaderboard-item {
        padding: 8px 12px;
    }
    
    .quiz-avatar-options {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .quiz-avatar-option {
        width: 50px;
        height: 50px;
    }
    
    .quiz-color-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quiz-color-option {
        height: 50px;
    }
    
    .quiz-background-character {
        font-size: 2rem;
    }
}

/* 닫기 버튼 (전체 화면 모드용) */
.quiz-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10000;
    transition: all 0.2s ease;
    font-size: 1.2rem;
    color: #374151;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.quiz-close-btn:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.quiz-close-btn i {
    transition: transform 0.2s ease;
}

.quiz-close-btn:hover i {
    transform: rotate(90deg);
}

/* 배경 캐릭터들 */
.quiz-background-characters {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

.quiz-background-character {
    position: absolute;
    font-size: 3rem;
    animation: bounce 3s infinite;
    opacity: 0.2;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.quiz-background-character:nth-child(1) { top: 10%; left: 10%; animation-delay: 0s; color: #3b82f6; }
.quiz-background-character:nth-child(2) { top: 20%; right: 15%; animation-delay: 0.5s; color: #10b981; }
.quiz-background-character:nth-child(3) { bottom: 30%; left: 8%; animation-delay: 1s; color: #f59e0b; }
.quiz-background-character:nth-child(4) { bottom: 15%; right: 12%; animation-delay: 1.5s; color: #ef4444; }
.quiz-background-character:nth-child(5) { top: 50%; left: 5%; animation-delay: 2s; color: #8b5cf6; }
.quiz-background-character:nth-child(6) { top: 35%; right: 8%; animation-delay: 2.5s; color: #f97316; }

/* 게임 완료 화면 스타일 */
.quiz-results-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 24px 0;
    padding: 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.quiz-result-stat {
    text-align: center;
    padding: 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s ease;
}

.quiz-result-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.quiz-result-stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #1e293b;
    line-height: 1;
    margin-bottom: 4px;
}

.quiz-result-stat-label {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

.quiz-game-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 24px 0;
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
}

.quiz-detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #475569;
}

.quiz-detail-item i {
    width: 16px;
    text-align: center;
}

.quiz-achievement {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    border-radius: 8px;
    color: #92400e;
    font-weight: 500;
    margin: 16px 0;
    animation: pulse 2s infinite;
}

.quiz-achievement i {
    font-size: 1.25rem;
}

/* 모바일 반응형 - 게임 완료 화면 */
@media (max-width: 768px) {
    .quiz-results-summary {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px;
    }
    
    .quiz-result-stat {
        padding: 12px;
    }
    
    .quiz-result-stat-value {
        font-size: 1.5rem;
    }
    
    .quiz-game-details {
        padding: 16px;
    }
    
    .quiz-achievement {
        padding: 12px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .quiz-results-summary {
        padding: 12px;
        gap: 8px;
    }
    
    .quiz-result-stat {
        padding: 8px;
    }
    
    .quiz-result-stat-value {
        font-size: 1.25rem;
    }
    
    .quiz-result-stat-label {
        font-size: 0.75rem;
    }
}

/* 문제 이미지 중앙 정렬 */
.quiz-question-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 16px 0;
}

.quiz-question-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    object-fit: contain;
}

@media (max-width: 768px) {
    .quiz-question-image {
        max-height: 200px;
    }
}

@media (max-width: 480px) {
    .quiz-question-image {
        max-height: 150px;
    }
}