/* 지식 퀴즈 앱 - 2026 게임/퀴즈 테마 */
/* Primary: #667eea (보라-파랑) - Kahoot 스타일 활기찬 느낌 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* 터치 최적화 */
button, a, input, [role="button"], [role="link"] {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

input[type="text"], textarea {
    -webkit-user-select: text;
    user-select: text;
}

:root {
    --primary: #667eea;
    --primary-light: #7c8ff8;
    --primary-dark: #5a6fd6;
    --secondary: #764ba2;
    --accent: #f093fb;
    --success: #00d26a;
    --danger: #ff6b6b;
    --warning: #ffd93d;
    --background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --surface: rgba(255, 255, 255, 0.95);
    --surface-glass: rgba(255, 255, 255, 0.15);
    --text: #2d3436;
    --text-light: #636e72;
    --text-white: #ffffff;
}

/* App Loader */
.app-loader {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s;
}
.app-loader.hidden {
    opacity: 0;
    pointer-events: none;
}
.loader-spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
    background: var(--background);
    min-height: 100vh;
    padding: 15px;
    position: relative;
    overflow-x: hidden;
}

/* 배경 장식 */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    z-index: 0;
    pointer-events: none;
}

body::before {
    width: 300px;
    height: 300px;
    top: -100px;
    right: -100px;
    animation: float 6s ease-in-out infinite;
}

body::after {
    width: 200px;
    height: 200px;
    bottom: -50px;
    left: -50px;
    animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

.container {
    max-width: 500px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* 언어 선택 - 우측 상단 고정 */
.language-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.lang-btn {
    background: var(--surface-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--text-white);
    font-size: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.lang-menu {
    position: absolute;
    top: 52px;
    right: 0;
    background: var(--surface);
    border-radius: 12px;
    padding: 8px;
    min-width: 150px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease;
}

.lang-menu.hidden {
    display: none;
}

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

.lang-option {
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    transition: background 0.2s ease;
}

.lang-option:hover {
    background: rgba(102, 126, 234, 0.1);
}

.lang-option.active {
    background: rgba(102, 126, 234, 0.2);
    font-weight: 600;
}

/* 광고 배너 */
.ad-banner {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 12px;
    text-align: center;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    max-width: 500px;
    margin: 0 auto 10px;
}

.ad-banner.ad-bottom {
    margin: 10px auto 0;
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 30px);
    max-width: 500px;
    z-index: 100;
}

.ad-result-area {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 16px;
    text-align: center;
    border-radius: 12px;
    margin: 20px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ad-placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    letter-spacing: 1px;
    font-weight: 500;
}

/* 헤더 - 게임 느낌 */
.app-header {
    background: var(--surface);
    border-radius: 24px;
    padding: 25px;
    text-align: center;
    margin-bottom: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.app-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
}

.app-header h1 {
    font-size: 2rem;
    font-weight: 800;
    color: #2d3436;
    margin-bottom: 15px;
    text-shadow: none;
}

.score-board {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 1rem;
    color: var(--text-light);
}

.score-board span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-board strong {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* 프로그레스 바 - 그라데이션 강화 */
.progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(102, 126, 234, 0.15);
    border-radius: 5px;
    margin-top: 15px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    border-radius: 5px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 12px rgba(102, 126, 234, 0.6), inset 0 1px 0 rgba(255,255,255,0.3);
    position: relative;
}

/* 퀴즈 영역 */
.quiz-container {
    background: var(--surface);
    border-radius: 24px;
    padding: 30px 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    min-height: 450px;
}

.question-card {
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* 문제 번호 배지 */
.question-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 20px;
}

#question-text {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 30px;
    line-height: 1.7;
    word-break: keep-all;
}

/* 답변 버튼 - Kahoot 스타일 */
.answers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.answer-btn {
    background: white;
    border: 3px solid transparent;
    padding: 20px 15px;
    min-height: 48px;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 각 답변 버튼 색상 (Kahoot 스타일) */
.answer-btn:nth-child(1) {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.answer-btn:nth-child(2) {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.answer-btn:nth-child(3) {
    background: linear-gradient(135deg, #f39c12, #d68910);
    color: white;
}

.answer-btn:nth-child(4) {
    background: linear-gradient(135deg, #27ae60, #1e8449);
    color: white;
}

.answer-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.answer-btn:hover::before {
    left: 100%;
}

.answer-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.answer-btn:active {
    transform: scale(0.97);
}

/* 정답/오답 애니메이션 - 강화 */
.answer-btn.correct {
    background: linear-gradient(135deg, var(--success), #00b359) !important;
    border-color: var(--success);
    animation: pulse-correct 0.6s ease forwards;
    box-shadow: 0 8px 20px rgba(0, 210, 106, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

@keyframes pulse-correct {
    0% { transform: scale(1); box-shadow: 0 8px 20px rgba(0, 210, 106, 0.4); }
    50% { transform: scale(1.08); box-shadow: 0 12px 30px rgba(0, 210, 106, 0.6); }
    100% { transform: scale(1); box-shadow: 0 8px 20px rgba(0, 210, 106, 0.4); }
}

.answer-btn.wrong {
    background: linear-gradient(135deg, var(--danger), #e55555) !important;
    border-color: var(--danger);
    animation: shake 0.6s ease forwards;
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-12px) rotateZ(-1deg); }
    20% { transform: translateX(12px) rotateZ(1deg); }
    30% { transform: translateX(-8px) rotateZ(-1deg); }
    40% { transform: translateX(8px) rotateZ(1deg); }
    50% { transform: translateX(0); }
    60% { transform: translateX(-6px) rotateZ(-0.5deg); }
    70% { transform: translateX(6px) rotateZ(0.5deg); }
    80% { transform: translateX(-4px); }
    90% { transform: translateX(4px); }
}

.answer-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    transform: none !important;
}

.answer-btn:disabled:hover::before {
    left: -100%;
}

/* 결과 화면 */
.result-screen {
    text-align: center;
    padding: 40px 20px;
    animation: scaleIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.result-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.result-screen h2 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.result-message {
    color: var(--text-light);
    font-size: 1rem;
    margin-bottom: 25px;
}

.final-score {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: var(--text);
}

.final-score strong {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--success), #00b359);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 점수 등급 */
.score-grade {
    display: inline-block;
    padding: 10px 25px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 25px;
}

.grade-excellent {
    background: linear-gradient(135deg, #ffd700, #ffb700);
    color: #5a4000;
}

.grade-good {
    background: linear-gradient(135deg, var(--success), #00b359);
    color: white;
}

.grade-average {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.grade-poor {
    background: linear-gradient(135deg, var(--danger), #e55555);
    color: white;
}

/* 버튼 - CTA 강화 */
.btn {
    padding: 18px 50px;
    min-height: 48px;
    font-size: 1.1rem;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    animation: ctaPulse 2s ease-in-out infinite;
    animation-delay: 0s;
}

@keyframes ctaPulse {
    0%, 100% {
        box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 12px 35px rgba(102, 126, 234, 0.6);
    }
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::after {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 14px 40px rgba(102, 126, 234, 0.6);
}

.btn-primary:active {
    transform: translateY(-1px) scale(0.98);
}

/* 숨김 클래스 */
.hidden {
    display: none !important;
}

/* 전면 광고 */
.interstitial-ad {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.ad-content {
    background: var(--surface);
    padding: 50px;
    border-radius: 24px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.ad-content p {
    font-size: 1.1rem;
    margin-bottom: 25px;
    color: var(--text);
}

.btn-close {
    background: linear-gradient(135deg, var(--danger), #e55555);
    color: white;
    border: none;
    padding: 14px 35px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

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

/* 통계 카드 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 25px;
}

.stat-card {
    background: rgba(102, 126, 234, 0.1);
    padding: 15px;
    border-radius: 16px;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 5px;
}

/* 반응형 디자인 */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .app-header {
        padding: 20px;
    }

    .app-header h1 {
        font-size: 1.6rem;
    }

    .score-board {
        gap: 20px;
    }

    .score-board strong {
        font-size: 1.3rem;
    }

    .quiz-container {
        padding: 25px 20px;
    }

    #question-text {
        font-size: 1.2rem;
    }

    .answers {
        grid-template-columns: 1fr;
    }

    .answer-btn {
        padding: 18px;
        min-height: 48px;
    }

    .final-score strong {
        font-size: 2.5rem;
    }
}

/* 360px 초소형 모바일 */
@media (max-width: 360px) {
    body {
        padding: 8px;
    }

    .container {
        max-width: 360px;
    }

    .ad-banner {
        padding: 8px;
        margin-bottom: 8px;
    }

    .app-header {
        padding: 16px;
        margin-bottom: 12px;
        border-radius: 20px;
    }

    .app-header h1 {
        font-size: 1.4rem;
        margin-bottom: 10px;
    }

    .score-board {
        gap: 16px;
        font-size: 0.85rem;
    }

    .score-board strong {
        font-size: 1.2rem;
    }

    .progress-bar {
        margin-top: 12px;
        height: 6px;
    }

    .quiz-container {
        padding: 20px 16px;
        min-height: 400px;
        border-radius: 20px;
    }

    .question-badge {
        padding: 6px 12px;
        font-size: 0.8rem;
        margin-bottom: 16px;
    }

    #question-text {
        font-size: 1.1rem;
        margin-bottom: 20px;
        word-break: break-word;
    }

    .answers {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .answer-btn {
        padding: 14px 12px;
        font-size: 0.95rem;
        min-height: 44px;
        border-radius: 12px;
    }

    .result-screen {
        padding: 30px 16px;
    }

    .result-icon {
        font-size: 4rem;
        margin-bottom: 16px;
    }

    .result-screen h2 {
        font-size: 1.6rem;
        margin-bottom: 8px;
    }

    .result-message {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }

    .final-score {
        font-size: 1.1rem;
        margin-bottom: 20px;
    }

    .final-score strong {
        font-size: 2.2rem;
    }

    .score-grade {
        padding: 8px 20px;
        font-size: 1rem;
        margin-bottom: 20px;
    }

    .btn {
        padding: 14px 30px;
        font-size: 1rem;
        border-radius: 24px;
        min-height: 44px;
    }

    .stats-grid {
        gap: 10px;
        margin-top: 20px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .ad-content {
        padding: 30px 20px;
        max-width: 340px;
    }

    .ad-content p {
        font-size: 1rem;
        margin-bottom: 20px;
    }

    .btn-close {
        padding: 12px 28px;
        font-size: 0.95rem;
        min-height: 44px;
    }

    .interstitial-overlay {
        padding: 12px;
    }

    .interstitial-content {
        padding: 30px 20px;
        max-width: 340px;
    }

    .close-ad-btn {
        padding: 10px 24px;
        font-size: 0.9rem;
        min-height: 44px;
    }

    .premium-btn {
        padding: 12px 20px;
        font-size: 0.95rem;
        min-height: 44px;
    }

    .modal-content {
        width: 90%;
        padding: 1.5rem;
    }

    .modal-header h3 {
        font-size: 1.3rem;
    }

    .modal-close {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }

    .premium-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .premium-stat {
        padding: 12px 8px;
    }

    .premium-stat-value {
        font-size: 1.2rem;
    }

    .premium-stat-label {
        font-size: 0.7rem;
    }

    .rec-card {
        padding: 12px 14px;
        gap: 12px;
    }

    .rec-icon {
        font-size: 24px;
    }

    .rec-name {
        font-size: 13px;
    }

    .rec-desc {
        font-size: 11px;
    }

    .back-link {
        font-size: 12px;
    }

    /* 터치 타겟 최소화 */
    button, a {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* 스크롤바 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

/* 선택 색상 */
::selection {
    background: var(--primary);
    color: white;
}

/* CTA Badges - Social Proof */
.cta-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 12px;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Recommendations Section - Enhanced */
.recommendations-section {
    margin: 24px -25px -30px;
    padding: 32px 25px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0 0 24px 24px;
    position: relative;
}

.recommendations-section::before {
    content: '✨ 더 많은 앱을 즐기세요';
    display: block;
    text-align: center;
    color: rgba(255,255,255,0.6);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.rec-title {
    font-size: 16px;
    font-weight: 800;
    color: rgba(255,255,255,0.95);
    margin-bottom: 16px;
    text-align: center;
    letter-spacing: 0.5px;
}

.rec-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.rec-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 14px;
    background: rgba(255,255,255,0.12);
    border: 1.5px solid rgba(255,255,255,0.2);
    border-radius: 16px;
    text-decoration: none;
    color: #fff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    min-height: 90px;
    position: relative;
    overflow: hidden;
}

.rec-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.rec-card:hover {
    background: rgba(255,255,255,0.18);
    transform: translateY(-3px) scale(1.02);
    border-color: rgba(255,255,255,0.35);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.rec-card:hover::before {
    opacity: 1;
}

.rec-icon {
    font-size: 32px;
    flex-shrink: 0;
    animation: bounceIcon 0.6s ease infinite;
}

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

.rec-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.rec-name {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.rec-desc {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    font-weight: 500;
}

/* 모달 스타일 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-header h3 {
    font-size: 1.5rem;
    margin: 0;
}

.modal-close {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-body p {
    color: #333;
    line-height: 1.6;
    white-space: pre-line;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* 전면 광고 오버레이 */
.interstitial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.interstitial-overlay.hidden {
    display: none;
}

.interstitial-content {
    background: var(--surface);
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.ad-label {
    font-size: 0.8rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 20px;
}

.ad-placeholder-large {
    background: rgba(102, 126, 234, 0.1);
    padding: 60px 20px;
    border-radius: 12px;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.close-ad-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.close-ad-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* 프리미엄 버튼 */
.premium-section {
    margin: 20px 0;
}

.premium-btn {
    background: linear-gradient(135deg, #ffd700, #ffb700);
    color: #5a4000;
    border: none;
    padding: 14px 28px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

.premium-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.5);
}

.premium-badge {
    background: rgba(90, 64, 0, 0.2);
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 800;
}

/* 프리미엄 모달 콘텐츠 */
.premium-modal-content {
    max-height: 80vh;
    overflow-y: auto;
}

.premium-analysis {
    text-align: left;
}

.premium-level {
    text-align: center;
    margin-bottom: 20px;
}

.premium-level-badge {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.premium-level p {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.5;
}

.premium-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.premium-stat {
    background: rgba(102, 126, 234, 0.1);
    padding: 15px 10px;
    border-radius: 12px;
    text-align: center;
}

.premium-stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
}

.premium-stat-label {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 4px;
}

.premium-section-block {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 12px;
}

.premium-section-block h4 {
    margin-bottom: 12px;
    color: var(--text);
    font-size: 1rem;
}

.premium-category-bar {
    margin-bottom: 10px;
}

.bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: var(--text);
}

.bar-track {
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

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

.premium-tips li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text);
}

.premium-wrong-detail {
    margin-top: 10px;
}

.wrong-item {
    background: white;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    border-left: 3px solid #e74c3c;
}

.wrong-q {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--text);
}

.wrong-a {
    font-size: 0.85rem;
    color: var(--text);
    margin-bottom: 4px;
}

.wrong-tip {
    font-size: 0.8rem;
    color: var(--text-light);
    background: rgba(102, 126, 234, 0.05);
    padding: 6px 8px;
    border-radius: 6px;
}

/* === FOOTER === */
.game-footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 20px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    font-size: 13px;
    padding: 12px 0;
    transition: color 0.2s;
}

.back-link:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* === Accessibility Improvements === */

/* Focus Visible for All Interactive Elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[role="link"]:focus-visible {
    outline: 3px solid #4a90e2;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Fallback focus style for older browsers */
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

/* Ensure minimum touch target size (44px) */
button,
a[href],
input[type="button"],
input[type="submit"],
[role="button"],
[role="link"] {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #667eea;
    color: white;
    padding: 8px 12px;
    text-decoration: none;
    z-index: 100;
    font-weight: 600;
}

.skip-link:focus {
    top: 0;
}

/* Modal accessibility */
[role="dialog"] {
    z-index: 1000;
}

.modal-close:focus-visible {
    outline: 3px solid #4a90e2;
    outline-offset: -2px;
}

/* Progress bar accessibility */
[role="progressbar"] {
    min-height: 8px;
}

/* Answer buttons accessibility - Enhanced */
.answer-btn {
    min-height: 54px;
    font-size: 16px;
    text-align: center;
}

.answer-btn:focus-visible {
    outline: 3px solid #4a90e2;
    outline-offset: 2px;
}

/* Language selector button - accessibility */
.lang-btn {
    min-width: 48px;
    min-height: 48px;
}

.lang-btn:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 2px;
}

/* Language options accessibility */
.lang-option {
    min-height: 44px;
    padding: 12px 14px;
}

.lang-option:focus-visible {
    outline: 3px solid #4a90e2;
    outline-offset: -2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .pulse,
    [class*="bounce"],
    [class*="slide"],
    [class*="fade"],
    [class*="float"],
    [class*="animation"] {
        animation: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: more) {
    button {
        border: 2px solid #667eea;
    }

    .score-board {
        color: #ffffff;
        text-shadow: 0 0 2px #667eea;
    }

    .app-header h1 {
        border-bottom: 3px solid #667eea;
        padding-bottom: 10px;
    }
}

/* Color contrast improvements */
.score-board {
    font-size: 16px;
    font-weight: 500;
    color: #333333; /* Improved contrast */
}

.rec-card:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 4px;
}

/* Ad placeholder - improved contrast for readability */
.ad-placeholder {
    color: rgba(255, 255, 255, 0.8); /* Increased from 0.5 */
    font-size: 12px; /* Minimum readable size */
    letter-spacing: 1px;
    font-weight: 600; /* Bold for better contrast */
}

/* Back link - improved visibility */
.back-link {
    color: rgba(255, 255, 255, 0.85); /* Improved from 0.4 */
    font-weight: 600;
    text-decoration: underline;
}

.back-link:hover {
    color: rgba(255, 255, 255, 0.95); /* Improved from 0.7 */
}

/* Language selector text - improved contrast */
.lang-btn {
    background: rgba(255, 255, 255, 0.2); /* Increased opacity */
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3); /* Slightly more opaque */
}

/* Text color accessibility improvements */
#question-text {
    color: #1a1a1a; /* Darker for better contrast */
}

.result-message {
    color: #333333; /* Darker for better contrast */
}

/* === THEME TOGGLE === */
.theme-toggle {
    position: fixed;
    top: 12px;
    right: 56px;
    z-index: 1000;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-white);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-toggle:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}

/* === LIGHT MODE === */
[data-theme="light"] {
    --background: linear-gradient(135deg, #f5f5fa 0%, #e8e8f0 100%);
    --surface: #ffffff;
    --surface-glass: rgba(0, 0, 0, 0.05);
    --text: #1a1a2e;
    --text-light: #5a5a70;
    --text-white: #ffffff;
}

[data-theme="light"] body {
    background: var(--background);
}

[data-theme="light"] .lang-btn {
    background: rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.25);
    color: var(--primary);
}

[data-theme="light"] .lang-btn:hover {
    background: rgba(102, 126, 234, 0.25);
}

[data-theme="light"] .lang-menu {
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border-color: rgba(102, 126, 234, 0.2);
}

[data-theme="light"] .lang-option {
    color: var(--text);
}

[data-theme="light"] .lang-option:hover {
    background: rgba(102, 126, 234, 0.1);
}

[data-theme="light"] .lang-option.active {
    background: rgba(102, 126, 234, 0.15);
}

[data-theme="light"] .app-header {
    background: var(--surface);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .app-header h1 {
    color: var(--text);
}

[data-theme="light"] .score-board {
    color: var(--text-light);
}

[data-theme="light"] .quiz-container {
    background: var(--surface);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] #question-text {
    color: var(--text);
}

[data-theme="light"] .answer-btn {
    background: white;
    color: var(--text);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .answer-btn:hover {
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

[data-theme="light"] .progress-bar {
    background: rgba(102, 126, 234, 0.1);
}

[data-theme="light"] .stat-card {
    background: rgba(102, 126, 234, 0.08);
}

[data-theme="light"] .stat-label {
    color: var(--text-light);
}

[data-theme="light"] .ad-banner {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
    color: var(--text-light);
}

[data-theme="light"] .ad-placeholder {
    color: var(--text-light);
}

[data-theme="light"] .modal-content {
    background: var(--surface);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .modal-body p {
    color: var(--text);
}

[data-theme="light"] .interstitial-content {
    background: var(--surface);
}

[data-theme="light"] .interstitial-content p {
    color: var(--text);
}

[data-theme="light"] .ad-content p {
    color: var(--text);
}

[data-theme="light"] .recommendations-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

[data-theme="light"] .recommendations-section::before {
    color: var(--text-light);
}

[data-theme="light"] .rec-title {
    color: var(--primary);
}

[data-theme="light"] .rec-card {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(102, 126, 234, 0.2);
}

[data-theme="light"] .rec-card:hover {
    background: rgba(102, 126, 234, 0.1);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
}

[data-theme="light"] .rec-name {
    color: var(--text);
}

[data-theme="light"] .rec-desc {
    color: var(--text-light);
}

[data-theme="light"] .back-link {
    color: var(--text-light);
}

[data-theme="light"] .back-link:hover {
    color: var(--text);
}

[data-theme="light"] .theme-toggle {
    background: rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.25);
    color: var(--primary);
}

[data-theme="light"] .theme-toggle:hover {
    background: rgba(102, 126, 234, 0.25);
}

[data-theme="light"] body::before,
[data-theme="light"] body::after {
    background: rgba(102, 126, 234, 0.05);
}
