:root {
    --primary-gradient: linear-gradient(135deg, #f59e0b, #ea580c, #dc2626);
    --secondary-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --success-gradient: linear-gradient(135deg, #22c55e, #16a34a);
    --bg-soft: linear-gradient(135deg, #fff9f0 0%, #fff5e6 50%, #fef3c7 100%);
    --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 30px rgba(245, 158, 11, 0.3);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Montserrat', system-ui, -apple-system, sans-serif; background: var(--bg-soft); min-height: 100vh; overflow-x: hidden; position: relative; }

.bg-bubbles { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: hidden; }
.bubble { position: absolute; bottom: -50px; background: rgba(245, 158, 11, 0.1); border-radius: 50%; animation: float-up 15s infinite ease-in; opacity: 0.6; }
@keyframes float-up { 0% { transform: translateY(0) scale(0.5); opacity: 0; } 10%, 90% { opacity: 0.6; } 100% { transform: translateY(-120vh) scale(1.2); opacity: 0; } }

.hero-section { background: #fff; border-radius: 40px; box-shadow: var(--shadow-soft), var(--shadow-glow); border: 2px solid rgba(245, 158, 11, 0.3); position: relative; overflow: hidden; }
.hero-section::before { content: ''; position: absolute; top: -50%; right: -50%; width: 100%; height: 200%; background: radial-gradient(circle, rgba(245,158,11,0.1) 0%, transparent 70%); animation: pulse 4s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 0.5; } 50% { transform: scale(1.1); opacity: 0.8; } }
.badge-glow { background: var(--primary-gradient); color: white; padding: 10px 24px; border-radius: 50px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4); animation: glow-pulse 2s infinite; }
@keyframes glow-pulse { 0%, 100% { box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4); } 50% { box-shadow: 0 4px 35px rgba(245, 158, 11, 0.7); } }

.search-box { background: #f8fafc; border-radius: 60px; padding: 6px 20px; display: flex; align-items: center; gap: 12px; border: 2px solid #e2e8f0; transition: all 0.3s; }
.search-box:focus-within { border-color: #f59e0b; box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2); transform: scale(1.02); }
.search-box i { color: #f59e0b; font-size: 1.3rem; }
.search-box input { flex: 1; border: none; background: transparent; outline: none; font-size: 1rem; color: #1e293b; padding: 8px 0; }
.search-box input::placeholder { color: #94a3b8; }
.btn-clear { background: #e2e8f0; border: none; border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s; color: #64748b; }
.btn-clear:hover { background: #f59e0b; color: white; transform: rotate(90deg) scale(1.1); }
.search-hint { margin-top: 12px; font-size: 0.85rem; color: #94a3b8; display: flex; align-items: center; justify-content: center; gap: 6px; }

.progress-card { background: #fff; border-radius: 28px; padding: 20px 28px; box-shadow: var(--shadow-soft); border: 2px solid rgba(245, 158, 11, 0.2); position: relative; overflow: hidden; }
.progress-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--primary-gradient); }
.progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; flex-wrap: wrap; gap: 10px; }
.progress-numbers { font-weight: 800; font-size: 1.3rem; background: var(--primary-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.progress-bar-wrapper { background: #f1f5f9; border-radius: 20px; height: 12px; overflow: hidden; }
.progress-fill { background: var(--primary-gradient); border-radius: 20px; height: 100%; width: 0%; transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); position: relative; }
.progress-fill::after { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent); animation: shimmer 2s infinite; }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.progress-stats { display: flex; gap: 20px; margin-top: 12px; font-size: 0.85rem; color: #64748b; flex-wrap: wrap; }

.section-title { font-size: 1.8rem; font-weight: 800; color: #1e293b; display: flex; align-items: center; gap: 10px; }
.letters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 16px; padding: 10px; position: relative; min-height: 400px; }

.letter-card { background: linear-gradient(145deg, #fff, #fffaf0); border-radius: 28px; padding: 18px 12px; text-align: center; cursor: pointer; border: 3px solid #fed7aa; box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08); transition: all 0.3s ease; position: relative; overflow: visible; user-select: none; z-index: 1; }
.letter-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: radial-gradient(circle at 30% 30%, rgba(245,158,11,0.15), transparent 50%); opacity: 0; transition: opacity 0.3s; }
.letter-card:hover::before { opacity: 1; }
.letter-card:hover { border-color: #f59e0b; transform: translateY(-8px) scale(1.05); box-shadow: 0 20px 40px rgba(245, 158, 11, 0.25); z-index: 10; }
.letter-card:active { cursor: grabbing; }
.letter-card.learned { background: linear-gradient(145deg, #f0fdf4, #dcfce7); border-color: #22c55e; }
.letter-card.learned .letter-symbol { background: var(--success-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.letter-card.learned::after { content: '✓'; position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; background: #22c55e; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: 0.7rem; font-weight: bold; }

/* 🔤 Карточки без терминов (Ь, Ъ, Ы) */
.letter-card.special { background: linear-gradient(145deg, #f8fafc, #f1f5f9); border-color: #94a3b8; }
.letter-card.special .letter-symbol { background: linear-gradient(135deg, #64748b, #94a3b8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.letter-card.special small { color: #64748b; font-style: italic; }
.letter-card.special::after { content: '—'; position: absolute; top: 8px; right: 10px; font-size: 1rem; color: #94a3b8; font-weight: 700; }
.letter-card.special:hover { border-color: #64748b; transform: translateY(-5px) scale(1.03); }

.letter-emoji { font-size: 2.5rem; margin-bottom: 8px; display: block; transition: transform 0.3s; }
.letter-card:hover .letter-emoji { transform: scale(1.2) rotate(10deg); }
.letter-symbol { font-size: 2rem; font-weight: 900; background: var(--primary-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; display: block; line-height: 1; }
.letter-card small { font-size: 0.65rem; color: #94a3b8; display: block; margin-top: 10px; font-weight: 500; }

#flyingLettersContainer { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9998; overflow: hidden; }
.flying-letter { position: absolute; font-size: 4rem; font-weight: 900; background: var(--primary-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; cursor: pointer; pointer-events: auto; z-index: 9999; animation: letter-glow 0.5s ease-in-out infinite alternate; user-select: none; }
@keyframes letter-glow { from { filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.5)); } to { filter: drop-shadow(0 0 25px rgba(245, 158, 11, 0.8)); } }
.flying-letter.caught { animation: caught-pop 0.4s ease forwards; }
@keyframes caught-pop { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: 0.8; } 100% { transform: scale(0); opacity: 0; } }

.info-card { background: #fff; border-radius: 28px; padding: 28px; height: 100%; transition: all 0.3s; border: 2px solid #fee2b5; box-shadow: var(--shadow-soft); position: relative; overflow: hidden; }
.info-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--secondary-gradient); }
.info-card:hover { transform: translateY(-6px); box-shadow: 0 25px 50px rgba(0,0,0,0.12); border-color: #f59e0b; }
.info-card.gold { background: linear-gradient(145deg, #fffaf0, #fff5e6); border-color: #f59e0b; }
.info-card.gold::before { background: var(--primary-gradient); }
.info-icon { width: 60px; height: 60px; background: var(--primary-gradient); border-radius: 20px; display: flex; align-items: center; justify-content: center; margin-bottom: 20px; box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3); }
.info-icon i { font-size: 1.8rem; color: white; }
.info-card h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: 12px; color: #1e293b; }
.info-card p { color: #64748b; line-height: 1.7; margin-bottom: 15px; }
.info-tip { margin-top: 16px; padding: 10px 16px; background: linear-gradient(135deg, #fef3c7, #fed7aa); border-radius: 50px; display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; color: #b45309; font-weight: 500; }

.modal-content { border-radius: 32px; border: none; overflow: hidden; background: #fff; box-shadow: 0 30px 60px rgba(0,0,0,0.2); }
.modal-header { padding: 1.2rem 1.5rem; }
.modal-title { font-weight: 700; color: #1e293b; display: flex; align-items: center; gap: 10px; }
.term-badge { background: linear-gradient(135deg, #fef3c7, #fed7aa); padding: 6px 20px; border-radius: 50px; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: #b45309; margin: 10px 0; }
.fact-box { background: linear-gradient(135deg, #fef3c7, #fed7aa); padding: 18px; border-radius: 20px; margin-top: 20px; color: #92400e; border-left: 4px solid #f59e0b; }
.special-fact { background: linear-gradient(135deg, #f5f3ff, #ede9fe) !important; border-left-color: #8b5cf6 !important; color: #5b21b6 !important; }

.quiz-question { font-weight: 700; font-size: 1.2rem; color: #1e293b; margin-bottom: 20px; line-height: 1.5; }
.quiz-options { display: flex; flex-direction: column; gap: 12px; }
.quiz-opt { background: #f8fafc; border: 2px solid #e2e8f0; border-radius: 20px; padding: 14px 20px; text-align: left; transition: all 0.3s; font-weight: 500; color: #334155; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.quiz-opt:hover { background: #fef3c7; border-color: #f59e0b; transform: translateX(5px); }
.quiz-opt.correct { background: #f0fdf4; border-color: #22c55e; color: #166534; }
.quiz-opt.wrong { background: #fef2f2; border-color: #ef4444; color: #b91c1c; }
.quiz-feedback { margin-top: 20px; padding: 15px; border-radius: 16px; text-align: center; font-weight: 600; display: none; }
.quiz-feedback.show { display: block; animation: slide-up 0.3s ease; }
@keyframes slide-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.toast-notification { position: fixed; bottom: 25px; right: 25px; background: white; color: #1e293b; padding: 14px 24px; border-radius: 20px; z-index: 9999; opacity: 0; transform: translateX(150px) scale(0.9); transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); font-weight: 600; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15); border-left: 4px solid #f59e0b; display: flex; align-items: center; gap: 10px; max-width: 350px; }
.toast-notification.show { opacity: 1; transform: translateX(0) scale(1); }
.toast-notification.success { border-left-color: #22c55e; }
.toast-notification.error { border-left-color: #ef4444; }

.confetti { position: fixed; width: 10px; height: 10px; pointer-events: none; z-index: 9998; animation: confetti-fall 3s ease-out forwards; }
@keyframes confetti-fall { 0% { transform: translateY(-100px) rotate(0deg); opacity: 1; } 100% { transform: translateY(100vh) rotate(720deg); opacity: 0; } }

.mode-indicator { display: inline-flex; align-items: center; gap: 8px; padding: 8px 20px; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: white; border-radius: 50px; font-weight: 600; font-size: 0.9rem; margin-bottom: 20px; animation: mode-pulse 2s infinite; }
@keyframes mode-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); } 50% { box-shadow: 0 0 0 12px rgba(99, 102, 241, 0); } }

.footer { background: white; color: #64748b; border-top: 2px solid #e2e8f0; margin-top: 60px; }
.footer-icons { display: flex; justify-content: center; gap: 20px; margin-top: 15px; font-size: 1.5rem; }
.footer-icons i { color: #f59e0b; transition: transform 0.3s; cursor: pointer; }
.footer-icons i:hover { transform: scale(1.3) rotate(10deg); }

.empty-result { text-align: center; padding: 50px 20px; background: white; border-radius: 32px; width: 100%; grid-column: 1 / -1; animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.empty-result i { font-size: 4rem; color: #f59e0b; margin-bottom: 15px; display: block; }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
.letter-card { animation: fadeInUp 0.4s ease forwards; animation-delay: calc(var(--i, 0) * 0.03s); }

@media (max-width: 768px) {
    .hero-section { padding: 1.8rem !important; border-radius: 30px; }
    .hero-section h1 { font-size: 1.8rem !important; }
    .letters-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 12px; }
    .letter-card { padding: 14px 8px; border-radius: 22px; }
    .letter-emoji { font-size: 2rem; } .letter-symbol { font-size: 1.6rem; }
    .section-title { font-size: 1.4rem; }
    .progress-stats { flex-direction: column; gap: 8px; }
    .toast-notification { right: 15px; left: 15px; max-width: none; bottom: 15px; }
    .flying-letter { font-size: 3rem !important; }
}
@media (max-width: 480px) {
    .letters-grid { grid-template-columns: repeat(auto-fill, minmax(75px, 1fr)); }
    .letter-card { padding: 12px 6px; }
    .letter-emoji { font-size: 1.6rem; } .letter-symbol { font-size: 1.3rem; }
    .flying-letter { font-size: 2.5rem !important; }
}