/**
 * style.css - 영어 챌린지 메인 스타일시트
 * 모바일 웹앱 스타일 퀴즈 플랫폼
 * Color Scheme: Cosmic
 */

/* ============================================
   CSS Variables (Cosmic Theme)
   ============================================ */
:root {
    /* Primary Colors - Cosmic Purple/Blue */
    --primary: #667eea;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #764ba2;
    --accent: #f093fb;

    /* Gradient Backgrounds */
    --gradient-cosmic: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-sunset: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-ocean: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-gold: linear-gradient(135deg, #f5af19 0%, #f12711 100%);
    --gradient-emerald: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-dark: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);

    /* Text Colors */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --text-white: #ffffff;
    --text-dark: #111827;

    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f3f4f6;
    --bg-tertiary: #e5e7eb;
    --bg-dark: #1f2937;
    --bg-card: #ffffff;

    /* Game Colors */
    --game-success: #10b981;
    --game-error: #ef4444;
    --game-warning: #f59e0b;
    --game-info: #3b82f6;
    --game-gold: #fbbf24;
    --game-silver: #9ca3af;
    --game-bronze: #d97706;
    --game-exp: #8b5cf6;

    /* Trophy Colors */
    --trophy-gold: linear-gradient(135deg, #ffd700 0%, #ffb800 50%, #ffa500 100%);
    --trophy-silver: linear-gradient(135deg, #e8e8e8 0%, #c0c0c0 50%, #a8a8a8 100%);
    --trophy-bronze: linear-gradient(135deg, #cd7f32 0%, #b8860b 50%, #8b4513 100%);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.4);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Font Sizes */
    --font-xs: 11px;
    --font-sm: 13px;
    --font-base: 15px;
    --font-lg: 17px;
    --font-xl: 20px;
    --font-2xl: 24px;
    --font-3xl: 30px;
    --font-4xl: 36px;

    /* Z-Index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-toast: 600;

    /* Safe Area */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --header-height: 56px;
    --nav-height: 64px;
}

/* Dark Mode Variables */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --text-light: #9ca3af;
        --bg-primary: #111827;
        --bg-secondary: #1f2937;
        --bg-tertiary: #374151;
        --bg-card: #1f2937;
        --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
}

/* ============================================
   Reset & Base Styles
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: var(--font-base);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.app-style {
    padding-top: var(--header-height);
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
}

body.menu-open {
    overflow: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input, textarea, select {
    font-family: inherit;
    font-size: var(--font-base);
}

/* Visually Hidden (for accessibility) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   App Container
   ============================================ */
.app-container {
    position: relative;
    min-height: 100vh;
    max-width: 100%;
    overflow-x: hidden;
}

/* ============================================
   App Header
   ============================================ */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--gradient-cosmic);
    z-index: var(--z-fixed);
    box-shadow: var(--shadow-lg);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 var(--space-md);
    max-width: 768px;
    margin: 0 auto;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-white);
    text-decoration: none;
}

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.logo-text {
    font-size: var(--font-lg);
    font-weight: 700;
    letter-spacing: -0.5px;
}

.user-quick-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    color: var(--text-white);
}

.user-avatar {
    font-size: 20px;
}

.user-score {
    font-size: var(--font-sm);
    font-weight: 600;
}

/* Hamburger Menu Toggle */
.menu-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    transition: background 0.2s;
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hamburger {
    width: 20px;
    height: 2px;
    background: white;
    position: relative;
    transition: all 0.3s ease;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: white;
    transition: all 0.3s ease;
}

.hamburger::before {
    top: -6px;
}

.hamburger::after {
    top: 6px;
}

.menu-toggle.active .hamburger {
    background: transparent;
}

.menu-toggle.active .hamburger::before {
    top: 0;
    transform: rotate(45deg);
}

.menu-toggle.active .hamburger::after {
    top: 0;
    transform: rotate(-45deg);
}

/* ============================================
   Slide Menu
   ============================================ */
.slide-menu {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background: var(--bg-primary);
    z-index: var(--z-modal);
    transition: right 0.3s ease;
    overflow-y: auto;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
}

.slide-menu.active {
    right: 0;
}

.menu-header {
    padding: var(--space-xl) var(--space-lg);
    background: var(--gradient-cosmic);
    color: var(--text-white);
}

.menu-user-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.user-avatar-large {
    font-size: 48px;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
}

.user-details {
    flex: 1;
}

.user-nickname {
    font-size: var(--font-lg);
    font-weight: 700;
    margin-bottom: 4px;
}

.user-rank {
    font-size: var(--font-sm);
    opacity: 0.9;
}

.menu-guest {
    text-align: center;
}

.guest-icon {
    font-size: 48px;
    display: block;
    margin-bottom: var(--space-sm);
}

.menu-guest p {
    margin-bottom: var(--space-md);
    font-size: var(--font-lg);
}

.menu-list {
    list-style: none;
    padding: var(--space-md) 0;
}

.menu-section {
    padding: var(--space-md) var(--space-lg) var(--space-sm);
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.menu-list li a {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.menu-list li a:hover,
.menu-list li a.active {
    background: var(--bg-secondary);
    color: var(--primary);
}

.menu-list li a span:first-child {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-modal) - 1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   App Main Content
   ============================================ */
.app-main {
    min-height: calc(100vh - var(--header-height) - var(--nav-height));
    padding: var(--space-md);
    max-width: 768px;
    margin: 0 auto;
}

/* ============================================
   App Navigation Bar (Bottom)
   ============================================ */
.app-nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--bg-primary);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--bg-tertiary);
    z-index: var(--z-fixed);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm);
    min-width: 64px;
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item:hover {
    color: var(--primary);
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 2px;
    transition: transform 0.2s ease;
}

.nav-item.active .nav-icon {
    transform: scale(1.1);
}

.nav-label {
    font-size: var(--font-xs);
    font-weight: 500;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-card);
    transition: all 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-glass {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    font-size: var(--font-base);
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-cosmic);
    color: var(--text-white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--text-white);
}

.btn-success {
    background: var(--gradient-emerald);
    color: var(--text-white);
}

.btn-danger {
    background: var(--game-error);
    color: var(--text-white);
}

.btn-small {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-sm);
}

.btn-large {
    padding: var(--space-lg) var(--space-2xl);
    font-size: var(--font-lg);
}

.btn-full {
    width: 100%;
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-md);
}

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

/* ============================================
   Badges
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: var(--font-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-primary {
    background: var(--primary);
    color: var(--text-white);
}

.badge-cosmic {
    background: var(--gradient-cosmic);
    color: var(--text-white);
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--game-success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--game-warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--game-error);
}

.badge-gold {
    background: var(--trophy-gold);
    color: #7c2d12;
}

.badge-silver {
    background: var(--trophy-silver);
    color: #374151;
}

.badge-bronze {
    background: var(--trophy-bronze);
    color: #fff;
}

/* ============================================
   Section & Content Layout
   ============================================ */
.section {
    padding: var(--space-lg) var(--space-md);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.section-title {
    font-size: var(--font-xl);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.section-subtitle {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

/* ============================================
   Trophy & Hall of Fame
   ============================================ */
.trophy-section {
    background: var(--gradient-cosmic);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
    color: var(--text-white);
    position: relative;
    overflow: hidden;
}

.trophy-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.trophy-header {
    text-align: center;
    margin-bottom: var(--space-xl);
    position: relative;
    z-index: 1;
}

.trophy-header h2 {
    font-size: var(--font-2xl);
    font-weight: 800;
    margin-bottom: var(--space-sm);
}

.trophy-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: var(--space-md);
    position: relative;
    z-index: 1;
}

.podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.podium-item.rank-1 {
    order: 2;
}

.podium-item.rank-2 {
    order: 1;
}

.podium-item.rank-3 {
    order: 3;
}

.podium-avatar {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: var(--space-sm);
    position: relative;
}

.podium-item.rank-1 .podium-avatar {
    width: 80px;
    height: 80px;
    font-size: 40px;
    border: 3px solid var(--game-gold);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

.podium-crown {
    position: absolute;
    top: -20px;
    font-size: 24px;
}

.podium-name {
    font-weight: 700;
    font-size: var(--font-sm);
    margin-bottom: 2px;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.podium-score {
    font-size: var(--font-xs);
    opacity: 0.9;
}

.podium-stand {
    width: 70px;
    margin-top: var(--space-sm);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-2xl);
    font-weight: 800;
}

.podium-item.rank-1 .podium-stand {
    height: 80px;
    background: var(--trophy-gold);
    color: #92400e;
}

.podium-item.rank-2 .podium-stand {
    height: 60px;
    background: var(--trophy-silver);
    color: #4b5563;
}

.podium-item.rank-3 .podium-stand {
    height: 45px;
    background: var(--trophy-bronze);
    color: #fff;
}

/* ============================================
   Ranking List
   ============================================ */
.ranking-list {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    border-bottom: 1px solid var(--bg-tertiary);
    transition: background 0.2s ease;
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-item:hover {
    background: var(--bg-secondary);
}

.ranking-item.me {
    background: rgba(102, 126, 234, 0.1);
}

.rank-number {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-base);
    margin-right: var(--space-md);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.rank-number.rank-1 {
    background: var(--trophy-gold);
    color: #92400e;
}

.rank-number.rank-2 {
    background: var(--trophy-silver);
    color: #4b5563;
}

.rank-number.rank-3 {
    background: var(--trophy-bronze);
    color: #fff;
}

.rank-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: var(--space-md);
}

.rank-info {
    flex: 1;
    min-width: 0;
}

.rank-name {
    font-weight: 600;
    font-size: var(--font-base);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-stats {
    font-size: var(--font-xs);
    color: var(--text-light);
}

.rank-score {
    text-align: right;
}

.rank-score-value {
    font-weight: 700;
    font-size: var(--font-lg);
    color: var(--primary);
}

.rank-score-label {
    font-size: var(--font-xs);
    color: var(--text-light);
}

/* ============================================
   Quiz Category Cards
   ============================================ */
.quiz-categories {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.category-card {
    position: relative;
    border-radius: var(--radius-lg);
    padding: var(--space-xl) var(--space-lg);
    text-align: center;
    color: var(--text-white);
    text-decoration: none;
    overflow: hidden;
    transition: all 0.3s ease;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    background: rgba(255, 255, 255, 0.1);
    transition: opacity 0.3s ease;
}

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

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.category-card.capitals {
    background: var(--gradient-ocean);
}

.category-card.history {
    background: var(--gradient-sunset);
}

.category-card.vocabulary {
    background: var(--gradient-emerald);
}

.category-card.mixed {
    background: var(--gradient-cosmic);
}

.category-icon {
    font-size: 48px;
    margin-bottom: var(--space-md);
    display: block;
}

.category-name {
    font-size: var(--font-lg);
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.category-desc {
    font-size: var(--font-sm);
    opacity: 0.9;
}

.category-badge {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--font-xs);
    font-weight: 600;
}

/* ============================================
   Quiz Game Interface
   ============================================ */
.quiz-container {
    max-width: 600px;
    margin: 0 auto;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.quiz-progress {
    flex: 1;
    margin-right: var(--space-md);
}

.quiz-progress-text {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-sm);
    margin-bottom: var(--space-xs);
}

.quiz-timer {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    font-weight: 600;
}

.quiz-timer.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--game-warning);
}

.quiz-timer.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--game-error);
    animation: pulse 1s infinite;
}

.quiz-question-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.quiz-category-badge {
    display: inline-block;
    margin-bottom: var(--space-md);
}

.quiz-question {
    font-size: var(--font-xl);
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: var(--space-lg);
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.quiz-option {
    display: flex;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    font-size: var(--font-base);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.quiz-option:hover:not(:disabled) {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.1);
}

.quiz-option.selected {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.15);
}

.quiz-option.correct {
    border-color: var(--game-success);
    background: rgba(16, 185, 129, 0.15);
}

.quiz-option.incorrect {
    border-color: var(--game-error);
    background: rgba(239, 68, 68, 0.15);
}

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

.option-letter {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-right: var(--space-md);
    font-size: var(--font-sm);
}

.quiz-option.correct .option-letter {
    background: var(--game-success);
    color: white;
}

.quiz-option.incorrect .option-letter {
    background: var(--game-error);
    color: white;
}

.quiz-hint {
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: rgba(139, 92, 246, 0.1);
    border-radius: var(--radius-md);
    color: var(--game-exp);
    font-size: var(--font-sm);
}

.quiz-hint::before {
    content: '💡 힌트: ';
    font-weight: 600;
}

/* Quiz Result */
.quiz-result {
    text-align: center;
    padding: var(--space-xl);
}

.result-emoji {
    font-size: 80px;
    margin-bottom: var(--space-lg);
    animation: bounce-in 0.5s ease;
}

.result-title {
    font-size: var(--font-2xl);
    font-weight: 800;
    margin-bottom: var(--space-sm);
}

.result-subtitle {
    font-size: var(--font-base);
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.result-stat {
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

.result-stat-value {
    font-size: var(--font-2xl);
    font-weight: 700;
    color: var(--primary);
}

.result-stat-label {
    font-size: var(--font-xs);
    color: var(--text-light);
}

.result-score {
    font-size: var(--font-4xl);
    font-weight: 900;
    background: var(--gradient-cosmic);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-lg);
}

/* ============================================
   Progress Bar
   ============================================ */
.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-cosmic);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.progress-fill.success {
    background: var(--gradient-emerald);
}

.progress-fill.warning {
    background: var(--gradient-gold);
}

.progress-fill.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* ============================================
   Modals
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--bg-tertiary);
}

.modal-header h3 {
    font-size: var(--font-lg);
    font-weight: 700;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text-light);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-lg);
    overflow-y: auto;
    max-height: calc(90vh - 160px);
}

.modal-desc {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    text-align: center;
}

.modal-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--bg-tertiary);
}

/* Avatar Selector */
.avatar-selector {
    margin-bottom: var(--space-lg);
}

.avatar-selector .label {
    font-size: var(--font-sm);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

.avatar-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    justify-content: center;
}

.avatar-option {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    border: 2px solid var(--bg-tertiary);
    background: var(--bg-secondary);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.avatar-option:hover {
    border-color: var(--primary);
    transform: scale(1.1);
}

.avatar-option.selected {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.15);
}

/* Achievement Modal */
.achievement-popup .modal-content {
    text-align: center;
}

.achievement-celebration {
    padding: var(--space-2xl) var(--space-lg);
    background: var(--gradient-cosmic);
    color: var(--text-white);
}

.achievement-icon-large {
    font-size: 72px;
    margin-bottom: var(--space-md);
    animation: bounce-in 0.5s ease;
}

.achievement-title {
    font-size: var(--font-xl);
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.achievement-desc {
    opacity: 0.9;
    margin-bottom: var(--space-md);
}

.achievement-points {
    font-size: var(--font-lg);
    font-weight: 700;
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    display: inline-block;
}

/* ============================================
   Form Elements
   ============================================ */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    font-size: var(--font-sm);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: var(--space-md);
    border: 2px solid var(--bg-tertiary);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.form-group input::placeholder {
    color: var(--text-light);
}

.input-hint {
    font-size: var(--font-xs);
    color: var(--text-light);
    margin-top: var(--space-xs);
}

.input-error {
    color: var(--game-error);
}

/* ============================================
   Toast Messages
   ============================================ */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + var(--space-md));
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    width: 100%;
    max-width: 400px;
    padding: 0 var(--space-md);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-dark);
    color: var(--text-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    animation: slide-in-down 0.3s ease;
    pointer-events: auto;
}

.toast.success {
    background: var(--game-success);
}

.toast.error {
    background: var(--game-error);
}

.toast.warning {
    background: var(--game-warning);
    color: var(--text-dark);
}

.toast.info {
    background: var(--game-info);
}

.toast-icon {
    font-size: 20px;
}

.toast-message {
    flex: 1;
    font-size: var(--font-sm);
    font-weight: 500;
}

.toast-close {
    font-size: 18px;
    opacity: 0.7;
    cursor: pointer;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 1;
}

/* ============================================
   Confetti Canvas
   ============================================ */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: calc(var(--z-modal) + 1);
}

/* ============================================
   Utility Classes
   ============================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-light { color: var(--text-light); }
.text-white { color: var(--text-white); }
.text-success { color: var(--game-success); }
.text-error { color: var(--game-error); }
.text-warning { color: var(--game-warning); }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.pt-sm { padding-top: var(--space-sm); }
.pt-md { padding-top: var(--space-md); }
.pt-lg { padding-top: var(--space-lg); }

.pb-sm { padding-bottom: var(--space-sm); }
.pb-md { padding-bottom: var(--space-md); }
.pb-lg { padding-bottom: var(--space-lg); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================
   Loading States
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Empty States
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-title {
    font-size: var(--font-lg);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.empty-desc {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}
