/* Tailwind CSS CDN */
@import url('https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css');

/* ===== CSS Variables — 暖橙温馨风 ===== */
:root {
    /* 主色系：活力橙 → 暖金 */
    --primary: #FF9F43;
    --primary-dark: #E17055;
    --primary-light: #FECA57;
    /* 背景 */
    --bg-main: #FDF6F0;
    --bg-white: #FFFFFF;
    --bg-card: rgba(255, 252, 248, 0.85);
    /* 文字 */
    --text-dark: #3D3027;
    --text-gray: #8B7E74;
    --text-white: #FFFFFF;
    /* 功能色 */
    --danger: #E17055;
    --warning: #FECA57;
    --success: #00B894;
    --info: #FF9F43;
    /* 圆角 & 阴影 */
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 4px 20px rgba(255, 159, 67, 0.10);
    --shadow-hover: 0 8px 30px rgba(255, 159, 67, 0.18);
    --nav-height: 64px;
    --font-family: 'PingFang SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-family);
    background: var(--bg-main);
    color: var(--text-dark);
    min-height: 100vh;
    overflow-x: hidden;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    background: linear-gradient(160deg, #FDF6F0 0%, #FFF5EC 40%, #FDEBD0 100%);
}

/* ===== Page Container ===== */
#page-container {
    padding: 20px 16px calc(var(--nav-height) + 20px);
    min-height: 100vh;
}

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== 首页波浪装饰背景 ===== */
.home-wave-bg {
    position: relative;
    overflow: hidden;
}

.home-wave-bg::before {
    content: '';
    position: absolute;
    top: -60px;
    left: -20px;
    right: -20px;
    height: 200px;
    background: linear-gradient(135deg, rgba(255,159,67,0.15), rgba(254,202,87,0.12), rgba(225,112,85,0.08));
    border-radius: 0 0 50% 50%;
    z-index: 0;
    pointer-events: none;
}

.home-wave-bg::after {
    content: '';
    position: absolute;
    top: -30px;
    left: -30px;
    right: -30px;
    height: 160px;
    background: linear-gradient(135deg, rgba(254,202,87,0.1), rgba(255,159,67,0.06));
    border-radius: 0 0 60% 60%;
    z-index: 0;
    pointer-events: none;
}

.home-wave-bg > * {
    position: relative;
    z-index: 1;
}

/* ===== Glass Card ===== */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius);
    border: 1px solid rgba(255, 159, 67, 0.12);
    box-shadow: var(--shadow);
    padding: 20px;
    transition: all 0.3s ease;
}

.glass-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

/* ===== Buttons ===== */
.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #FF9F43 0%, #FECA57 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-family);
    box-shadow: 0 4px 15px rgba(255,159,67,0.3);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(255,159,67,0.4); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
    padding: 12px 24px;
    background: rgba(255, 159, 67, 0.1);
    color: #E17055;
    border: 2px solid var(--primary);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-family);
}

.btn-secondary:hover { background: var(--primary); color: white; }

.btn-danger {
    padding: 12px 24px;
    background: rgba(225, 112, 85, 0.1);
    color: var(--danger);
    border: 2px solid var(--danger);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-family);
}

.btn-danger:hover { background: var(--danger); color: white; }

/* ===== Bottom Nav ===== */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: 480px;
    width: 100%;
    height: var(--nav-height);
    background: rgba(255, 252, 248, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 159, 67, 0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-gray);
    text-decoration: none;
    font-size: 11px;
    padding: 6px 12px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.nav-item svg { transition: all 0.3s ease; }
.nav-item.active { color: var(--primary); }
.nav-item.active svg { transform: scale(1.1); }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(61, 48, 39, 0.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}

.modal-overlay.hidden { display: none; }

.modal-content {
    width: 100%;
    max-width: 380px;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    background: #FFF5EC;
    border-radius: var(--radius-sm);
    padding: 4px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-gray);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-family);
}

.auth-tab.active {
    background: white;
    color: #E17055;
    box-shadow: 0 2px 8px rgba(255,159,67,0.12);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-gray);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #F5E6D8;
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: all 0.3s ease;
    background: white;
    font-family: var(--font-family);
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255,159,67,0.15);
}

/* ===== Toast ===== */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
    width: calc(100% - 32px);
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    animation: toastIn 0.3s ease;
    backdrop-filter: blur(10px);
}

.toast.success { background: rgba(0,184,148,0.95); color: white; }
.toast.error { background: rgba(225,112,85,0.95); color: white; }
.toast.info { background: rgba(255,159,67,0.95); color: white; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-20px); }
}

/* ===== Section Title ===== */
.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dark);
}

.section-title .icon {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

/* ===== Word Card (3D Flip) ===== */
.word-card-container {
    perspective: 1000px;
    height: 280px;
    margin: 20px 0;
}

.word-card {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
    cursor: pointer;
}

.word-card.flipped { transform: rotateY(180deg); }

.word-card-front, .word-card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.word-card-front {
    background: linear-gradient(135deg, rgba(255,159,67,0.08), rgba(254,202,87,0.08));
    border: 2px solid rgba(255,159,67,0.2);
}

.word-card-back {
    background: linear-gradient(135deg, rgba(225,112,85,0.08), rgba(255,159,67,0.08));
    border: 2px solid rgba(225,112,85,0.2);
    transform: rotateY(180deg);
}

.word-card .word-text {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.word-card .phonetic-text {
    font-size: 16px;
    color: var(--text-gray);
    margin-bottom: 12px;
}

.word-card .meaning-text {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.word-card .example-text {
    font-size: 14px;
    color: var(--text-gray);
    text-align: center;
    line-height: 1.6;
    font-style: italic;
}

.speak-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255,159,67,0.3);
}

.speak-btn:hover { transform: scale(1.1); }
.speak-btn:active { transform: scale(0.95); }

/* ===== Progress Bar ===== */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #F5E6D8;
    border-radius: 4px;
    overflow: hidden;
    margin: 12px 0;
}

.progress-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ===== Stats Cards ===== */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 16px 0;
}

.stat-card {
    background: rgba(255,252,248,0.9);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    border: 1px solid rgba(255,159,67,0.1);
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-dark);
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-gray);
    margin-top: 4px;
}

/* ===== Task Cards ===== */
.task-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0;
}

.task-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(255,252,248,0.9);
    border-radius: var(--radius);
    border: 1px solid rgba(255,159,67,0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.task-card:hover { transform: translateX(4px); box-shadow: var(--shadow); }

.task-card .task-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.task-card .task-icon.green { background: linear-gradient(135deg, #FF9F43, #FECA57); }
.task-card .task-icon.orange { background: linear-gradient(135deg, #E17055, #FF9F43); }
.task-card .task-icon.blue { background: linear-gradient(135deg, #FECA57, #FDCB6E); }

.task-card .task-info { flex: 1; }
.task-card .task-title { font-size: 16px; font-weight: 600; }
.task-card .task-desc { font-size: 13px; color: var(--text-gray); margin-top: 2px; }

/* ===== Microphone Button ===== */
.mic-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    font-size: 32px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(255,159,67,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mic-btn:hover { transform: scale(1.05); }
.mic-btn:active { transform: scale(0.95); }
.mic-btn.recording {
    animation: pulse 1s ease infinite;
    background: linear-gradient(135deg, var(--danger), #C0392B);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 6px 20px rgba(225,112,85,0.35); }
    50% { box-shadow: 0 6px 40px rgba(225,112,85,0.6); transform: scale(1.05); }
}

/* ===== Calendar ===== */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin: 12px 0;
}

.calendar-header {
    text-align: center;
    font-size: 12px;
    color: var(--text-gray);
    padding: 4px;
    font-weight: 500;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 13px;
    color: var(--text-gray);
    position: relative;
}

.calendar-day.checked {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    font-weight: 600;
}

.calendar-day.today {
    border: 2px solid var(--primary);
    font-weight: 600;
}

.calendar-day.empty { color: transparent; }

/* ===== Score Stars ===== */
.stars {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin: 12px 0;
}

.stars .star {
    font-size: 24px;
    color: #E8D5C4;
    transition: all 0.3s ease;
}

.stars .star.active { color: #FECA57; transform: scale(1.1); }

/* ===== Import Area ===== */
.import-zone {
    border: 2px dashed rgba(255,159,67,0.3);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255,159,67,0.02);
}

.import-zone:hover { border-color: var(--primary); background: rgba(255,159,67,0.05); }
.import-zone.dragover { border-color: var(--primary); background: rgba(255,159,67,0.1); }

/* ===== Reading ===== */
.reading-content {
    line-height: 2;
    font-size: 16px;
    margin: 16px 0;
}

.reading-content .word-lookup {
    color: var(--primary-dark);
    cursor: pointer;
    border-bottom: 1px dashed var(--primary);
    transition: all 0.2s ease;
}

.reading-content .word-lookup:hover { background: rgba(255,159,67,0.1); }

/* ===== Choice Quiz ===== */
.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 0;
}

.quiz-option {
    padding: 14px 18px;
    background: rgba(255,252,248,0.9);
    border: 2px solid #F5E6D8;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: var(--font-family);
    text-align: left;
}

.quiz-option:hover { border-color: var(--primary); background: rgba(255,159,67,0.05); }
.quiz-option.correct { border-color: var(--success); background: rgba(0,184,148,0.1); color: #00B894; }
.quiz-option.wrong { border-color: var(--danger); background: rgba(225,112,85,0.1); color: var(--danger); }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,159,67,0.2); border-radius: 2px; }

/* ===== Utility ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* ===== Phonetic Card ===== */
.phonetic-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.phonetic-card {
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255,252,248,0.9);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,159,67,0.1);
}

.phonetic-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.phonetic-card .symbol {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-dark);
}

.phonetic-card .example {
    font-size: 12px;
    color: var(--text-gray);
    margin-top: 4px;
}

/* ===== Exam Result ===== */
.exam-score {
    font-size: 48px;
    font-weight: 700;
}

.exam-score.pass { color: var(--success); }
.exam-score.fail { color: var(--danger); }

/* ===== Level Tab ===== */
.level-tab {
    transition: all 0.3s ease;
}

.level-tab.active {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}

/* ===== Wrong Question Badge ===== */
.wrong-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 0 6px;
}

/* ===== Nav with 6 items ===== */
#bottom-nav {
    gap: 0;
}

#bottom-nav .nav-item {
    padding: 6px 8px;
    font-size: 10px;
}

#bottom-nav .nav-item svg {
    width: 22px;
    height: 22px;
}

/* ===== 暖色微交互动画 ===== */
@keyframes warmGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,159,67,0); }
    50% { box-shadow: 0 0 20px 4px rgba(255,159,67,0.15); }
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.btn-primary {
    background-size: 200% auto;
    background-image: linear-gradient(135deg, #FF9F43, #FECA57, #FF9F43);
    animation: shimmer 3s ease-in-out infinite;
}

.btn-primary:hover {
    animation: none;
    background-image: linear-gradient(135deg, #FF9F43, #FECA57);
}

/* ===== Gamification: XP Progress Bar ===== */
.xp-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.xp-level-badge {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

.xp-bar-wrap {
    flex: 1;
    height: 10px;
    background: #F5E6D8;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #FFD700, #FFA500);
    border-radius: 5px;
    transition: width 0.6s ease;
    position: relative;
}

.xp-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: xpShimmer 2s ease-in-out infinite;
}

@keyframes xpShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.xp-bar-text {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--text-gray);
    font-weight: 500;
    min-width: 56px;
    text-align: right;
}

/* ===== Gamification: Streak Card ===== */
.streak-card {
    text-align: center;
    padding: 20px;
    margin-bottom: 16px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(255,159,67,0.08), rgba(254,202,87,0.08));
    border: 1px solid rgba(255,159,67,0.12);
    backdrop-filter: blur(20px);
}

.streak-flame {
    font-size: 32px;
    margin-bottom: 4px;
}

.streak-count {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.2;
}

.streak-label {
    font-size: 14px;
    color: var(--text-gray);
}

/* ===== Gamification: Achievement Badges ===== */
.achievement-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-gray);
    margin-bottom: 10px;
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.achievement-badge {
    text-align: center;
    padding: 14px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.achievement-badge.unlocked {
    background: linear-gradient(135deg, rgba(255,215,0,0.08), rgba(255,165,0,0.08));
    border: 1px solid rgba(255,215,0,0.2);
}

.achievement-badge.locked {
    background: rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.06);
    opacity: 0.6;
}

.achievement-badge.unlocked:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255,215,0,0.15);
}

.badge-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.badge-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.badge-desc {
    font-size: 10px;
    color: var(--text-gray);
    line-height: 1.4;
}

.badge-xp {
    font-size: 10px;
    color: #FFA500;
    font-weight: 600;
    margin-top: 4px;
}

/* ===== Gamification: Home Achievements ===== */
.home-achievements {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.home-achievement-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, rgba(255,215,0,0.06), rgba(255,165,0,0.06));
    border-radius: 20px;
    border: 1px solid rgba(255,215,0,0.15);
}

.home-badge-icon {
    font-size: 16px;
}

.home-badge-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--primary-dark);
}

/* ===== Gamification: XP Float Animation ===== */
.xp-float {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 24px;
    font-weight: 700;
    color: #FFD700;
    text-shadow: 0 2px 8px rgba(255,215,0,0.5);
    pointer-events: none;
    z-index: 400;
    animation: xpFloatUp 1.5s ease-out forwards;
}

@keyframes xpFloatUp {
    0% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-60px); }
}

/* ===== Gamification: Level Up Modal ===== */
.level-up-overlay {
    position: fixed;
    inset: 0;
    background: rgba(61, 48, 39, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    animation: fadeIn 0.3s ease;
}

.level-up-card {
    position: relative;
    width: 280px;
    text-align: center;
    padding: 40px 30px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #FFF9F0, #FFF5EC);
    border: 2px solid rgba(255,215,0,0.3);
    box-shadow: 0 20px 60px rgba(255,159,67,0.3);
    overflow: hidden;
    animation: modalIn 0.4s ease;
}

.level-up-glow {
    position: absolute;
    top: -40px;
    left: -40px;
    right: -40px;
    height: 120px;
    background: radial-gradient(ellipse, rgba(255,215,0,0.2), transparent);
    pointer-events: none;
}

.level-up-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.level-up-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.level-up-level {
    font-size: 42px;
    font-weight: 800;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.level-up-name {
    font-size: 16px;
    color: var(--text-gray);
    margin-bottom: 20px;
}

/* ===== Gamification: Particles ===== */
.xp-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    animation: particleBurst 1.5s ease-out forwards;
}

@keyframes particleBurst {
    0% { opacity: 1; transform: scale(1) translate(0, 0); }
    100% { opacity: 0; transform: scale(0) translate(calc((var(--tx, 0)) * 1px), calc((var(--ty, 0)) * 1px)); }
}
