/* ============================================
   حميز نت - تعلم الإنجليزية بالذكاء الاصطناعي
   ============================================ */

:root {
    --primary: #00a651;
    --primary-dark: #006837;
    --primary-light: #22c55e;
    --primary-gradient: linear-gradient(135deg, #00a651, #22c55e);
    --secondary: #3399ff;
    --secondary-dark: #0066cc;
    --secondary-light: #66b3ff;
    --accent: #ffd700;
    --accent-dark: #ccab00;
    --accent-light: #ffed4e;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;
    --background: #000000;
    --background-secondary: #111111;
    --background-tertiary: #1a1a1a;
    --background-card: #1e1e1e;
    --background-elevated: #2a2a2a;
    --text: #ffffff;
    --text-muted: #cccccc;
    --text-light: #e5e5e5;
    --text-secondary: #b3b3b3;
    --border: #333333;
    --border-light: #404040;
    --border-lighter: #555555;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.5);
    --shadow-primary: 0 8px 25px rgba(0, 166, 81, 0.3);
    --header-height: 70px;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;
    --transition: 0.3s ease;
    --transition-fast: 0.15s ease;
    --glass-bg: rgba(26, 26, 26, 0.9);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-backdrop: blur(20px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, var(--background-secondary) 50%, var(--background) 100%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 20%, rgba(0, 166, 81, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(51, 153, 255, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(255, 215, 0, 0.04) 0%, transparent 50%);
    z-index: -1;
    animation: backgroundFloat 20s ease-in-out infinite;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

p { margin-bottom: 1rem; color: var(--text-muted); }
a { color: var(--primary); text-decoration: none; transition: all var(--transition); }
a:hover { color: var(--primary-light); }

ul, ol { margin-bottom: 1rem; padding-right: 1.5rem; }
li { margin-bottom: 0.5rem; color: var(--text-muted); }

.main-header {
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: var(--glass-backdrop);
    box-shadow: 0 2px 20px rgba(0, 166, 81, 0.2);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 998;
    height: var(--header-height);
    border-bottom: 1px solid rgba(0, 166, 81, 0.2);
    transition: all var(--transition);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
}

.logo-section { display: flex; flex-direction: column; gap: 0.25rem; }

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
    transition: all var(--transition);
}

.logo:hover { transform: scale(1.05); color: var(--primary-light); }
.logo i { color: var(--accent); font-size: 1.5em; }
.logo-tagline { font-size: 0.5rem; color: var(--text-muted); font-weight: 500; }

.nav-links { display: flex; gap: 1.5rem; list-style: none; margin: 0; padding: 0; }

.nav-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition);
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
}

.nav-link:hover, .nav-link.active { color: var(--primary); background: rgba(0, 166, 81, 0.1); }
.header-actions { display: flex; align-items: center; gap: 1rem; }

.header-lang-select select {
    padding: 0.4rem 0.6rem;
    background: var(--background-elevated);
    border: 1px solid var(--primary);
    border-radius: var(--border-radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}

.cta-button {
    background: var(--primary-gradient);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    font-weight: 600;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

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

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    flex-direction: column;
    gap: 4px;
    width: 40px;
    height: 40px;
    justify-content: center;
    align-items: center;
}

.hamburger-line {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
    transition: all var(--transition);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-menu-toggle.active .hamburger-line:nth-child(2) { opacity: 0; }
.mobile-menu-toggle.active .hamburger-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 999;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.mobile-menu.show { visibility: visible; opacity: 1; }

.mobile-menu-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.mobile-menu-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 85vw;
    height: 100%;
    background: rgba(0, 0, 0, 0.98);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.mobile-menu.show .mobile-menu-content { transform: translateX(0); }

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    min-height: var(--header-height);
}

.mobile-logo { display: flex; align-items: center; gap: 0.75rem; color: var(--primary); font-size: 1.125rem; font-weight: 700; }
.mobile-logo i { color: var(--accent); }

.mobile-menu-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.125rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.mobile-menu-close:hover { background: rgba(255, 255, 255, 0.1); color: var(--primary); }
.mobile-nav { flex: 1; padding: 1rem 0; }

.mobile-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 60px;
}

.mobile-nav-link:hover { background: rgba(0, 166, 81, 0.1); color: var(--primary); }
.mobile-nav-link i:first-child { margin-left: 0.75rem; color: var(--primary); font-size: 1.125rem; }
.mobile-nav-link span { flex: 1; text-align: center; }
.mobile-nav-link i:last-child { font-size: 0.875rem; color: var(--text-muted); }

.main-content { padding-top: var(--header-height); }
.section { padding: 5rem 0; }

.hero-section {
    padding: 1rem 0 5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 166, 81, 0.05) 0%, transparent 70%);
    animation: heroGlow 10s ease-in-out infinite;
}

@keyframes heroGlow {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(5%, 5%); }
}

.hero-content { position: relative; z-index: 1; }

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 166, 81, 0.15);
    border: 1px solid rgba(0, 166, 81, 0.3);
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    margin-bottom: 2rem;
    font-size: 0.875rem;
    color: var(--primary-light);
    animation: fadeInDown 0.8s ease;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    margin-bottom: 1.5rem;
    line-height: 1.1;
    animation: fadeInUp 0.8s ease 0.2s both;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto 2.5rem;
    line-height: 1.8;
    animation: fadeInUp 0.8s ease 0.4s both;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 3rem;
    animation: fadeInUp 0.8s ease 0.6s both;
}

.hero-btn {
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    font-family: inherit;
}

.primary-btn { background: var(--primary-gradient); color: white; }
.primary-btn:hover { transform: translateY(-3px); box-shadow: var(--shadow-primary); }

.secondary-btn { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.secondary-btn:hover { background: rgba(0, 166, 81, 0.1); transform: translateY(-3px); }

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
    animation: fadeInUp 0.8s ease 0.8s both;
}

.stat-item { display: flex; align-items: center; gap: 0.75rem; text-align: right; }
.stat-item i { font-size: 1.5rem; color: var(--primary); }
.stat-item strong { display: block; color: var(--text); font-size: 0.9rem; }
.stat-item span { font-size: 0.8rem; color: var(--text-muted); }

.lang-selector-hero { margin: 2.5rem 0; animation: fadeInUp 0.8s ease 0.5s both; }
.lang-selector-hero h3 { font-size: 1rem; color: var(--text-muted); margin-bottom: 1.25rem; font-weight: 500; }

.lang-buttons { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; }

.lang-select-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 1.25rem;
    background: var(--background-elevated);
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text);
    font-family: inherit;
    font-size: 0.8rem;
    min-width: 90px;
}

.lang-select-btn:hover {
    border-color: rgba(0, 166, 81, 0.5);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 166, 81, 0.15);
}

.lang-select-btn.active {
    border-color: var(--primary);
    background: rgba(0, 166, 81, 0.15);
    box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.15);
}

.lang-flag-big { font-size: 1.75rem; }

.section-header { text-align: center; margin-bottom: 3rem; }

.section-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    margin-bottom: 0.75rem;
    background: linear-gradient(45deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.section-subtitle { font-size: 1rem; color: var(--text-muted); max-width: 600px; margin: 0 auto; }

.typing-container {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-backdrop);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-xl);
}

.typing-controls { margin-bottom: 1.5rem; }
.control-group { display: flex; flex-direction: column; gap: 0.25rem; }
.control-group label { font-size: 0.8rem; color: var(--text-muted); }

.control-group select,
.typing-controls select {
    padding: 0.6rem 1rem;
    background: var(--background-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color var(--transition);
}

.control-group select:focus { border-color: var(--primary); outline: none; }

.generate-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
}

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

.word-count-input {
    width: 70px;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    background: var(--background-elevated);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    text-align: center;
}

.word-count-hint { font-size: 0.7rem; color: var(--text-muted); }

.custom-prompt-area { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }

.custom-prompt-area textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    background: var(--background-elevated);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    resize: vertical;
    direction: rtl;
    line-height: 1.6;
}

.custom-prompt-area textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.1); }

.manual-text-area { margin-top: 0.5rem; }
.manual-insert-toggle { background: var(--background-elevated) !important; color: var(--text) !important; border: 1px dashed var(--border-light) !important; }
.manual-insert-toggle:hover { border-color: var(--primary) !important; color: var(--primary) !important; }

.manual-insert-panel {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--background-elevated);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    animation: slideDown 0.2s ease;
}

.manual-insert-panel textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    background: var(--background);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    resize: vertical;
    direction: auto;
    line-height: 1.6;
}

.manual-insert-panel textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.1); }
.manual-insert-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.manual-insert-actions .generate-btn { flex: 1; min-width: 140px; }

.speak-selection-btn,
.ai-selection-btn { background: var(--background-secondary) !important; border: 1px solid var(--border-light) !important; }
.speak-selection-btn:hover { border-color: var(--primary) !important; color: var(--primary) !important; }
.ai-selection-btn:hover { border-color: #2196F3 !important; color: #2196F3 !important; }

.typing-stats-bar { display: flex; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }

.stat-box {
    background: var(--background-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: 0.75rem 1.25rem;
    text-align: center;
    flex: 1;
    min-width: 100px;
}

.stat-box i { display: block; color: var(--primary); margin-bottom: 0.25rem; font-size: 1rem; }
.stat-box span { display: block; font-size: 1.25rem; font-weight: 700; color: var(--text); }
.stat-box label { font-size: 0.7rem; color: var(--text-muted); }
.stat-box.error-stat i { color: var(--danger); }
.stat-box.error-stat span { color: var(--danger); }

.text-display-area {
    background: var(--background-secondary);
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    min-height: 150px;
    font-family: 'Inter', monospace;
    font-size: 1.2rem;
    line-height: 2;
    direction: ltr;
    text-align: left;
    position: relative;
    transition: border-color var(--transition);
}

.text-display-area:focus-within { border-color: var(--primary); }

.text-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; color: var(--text-muted); min-height: 100px; }
.text-placeholder i { font-size: 2.5rem; color: var(--primary); opacity: 0.5; }
.text-placeholder p { margin: 0; }

.char { transition: all 0.1s ease; display: inline; }
.char.correct { color: var(--success); }
.char.incorrect { color: var(--danger); background: rgba(239, 68, 68, 0.2); border-radius: 2px; }
.char.current { border-bottom: 2px solid var(--primary); animation: blink 1s step-end infinite; }
.char.pending { color: var(--text-muted); }
.char.speech-active { background: var(--primary); color: white; border-radius: 3px; padding: 1px 0; animation: speechPulse 0.3s ease; }

@keyframes speechPulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes blink { 50% { border-color: transparent; } }

.audio-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    padding: 1rem;
    background: var(--background-elevated);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-light);
}

.audio-btn {
    background: rgba(0, 166, 81, 0.15);
    border: 1px solid rgba(0, 166, 81, 0.3);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
}

.audio-btn:hover { background: rgba(0, 166, 81, 0.25); transform: translateY(-1px); }
.audio-btn.playing { background: var(--primary); color: white; }

.speed-control { display: flex; align-items: center; gap: 0.5rem; margin-right: auto; }
.speed-control label { font-size: 0.8rem; color: var(--text-muted); }
.speed-control input[type="range"] { width: 100px; accent-color: var(--primary); }
.speed-control span { font-size: 0.8rem; color: var(--primary); min-width: 35px; }

#loopBtn.active { background: rgba(0, 166, 81, 0.2); border-color: var(--primary); color: var(--primary); animation: loopPulse 2s infinite; }

@keyframes loopPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(0, 166, 81, 0.3); } 50% { box-shadow: 0 0 0 6px rgba(0, 166, 81, 0); } }

.loop-settings {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--background-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    flex-wrap: wrap;
}

.loop-settings label { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
.loop-settings select { padding: 0.3rem 0.5rem; background: var(--background-elevated); border: 1px solid var(--border-light); border-radius: var(--border-radius); color: var(--text); font-family: inherit; font-size: 0.75rem; cursor: pointer; }
.loop-counter { font-size: 0.8rem; color: var(--primary); font-weight: 600; min-width: 50px; }

.voice-selector { display: flex; align-items: center; gap: 0.5rem; }
.voice-selector label { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.35rem; white-space: nowrap; }
.voice-selector select { padding: 0.4rem 0.6rem; background: var(--background-secondary); border: 1px solid var(--border-light); border-radius: var(--border-radius); color: var(--text); font-family: inherit; font-size: 0.8rem; max-width: 200px; cursor: pointer; }

.voice-settings { margin-top: 1rem; }

.tts-engine-toggle { display: flex; align-items: center; }

.tts-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.8rem;
    background: var(--background-secondary);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tts-toggle-btn:hover { border-color: var(--primary); color: var(--primary); }
.tts-toggle-btn.active { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 2px 8px rgba(0, 166, 81, 0.3); }

.ai-tts-panel {
    margin-top: 0.75rem;
    padding: 1rem;
    background: linear-gradient(135deg, var(--background-elevated) 0%, rgba(0,166,81,0.05) 100%);
    border: 1px solid rgba(0,166,81,0.3);
    border-radius: 12px;
    animation: slideDown 0.2s ease;
}

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

.ai-tts-header { display: flex; align-items: center; gap: 0.5rem; color: var(--primary); font-weight: 600; font-size: 0.85rem; margin-bottom: 0.75rem; }
.ai-tts-header i { font-size: 1rem; }
.ai-tts-voices { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.ai-voice-group { display: flex; align-items: center; gap: 0.4rem; flex: 1; min-width: 180px; }
.ai-voice-group label { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; font-weight: 600; }
.ai-voice-group select { flex: 1; padding: 0.4rem 0.6rem; background: var(--background); border: 1px solid var(--border-light); border-radius: var(--border-radius); color: var(--text); font-family: inherit; font-size: 0.78rem; cursor: pointer; }

.ai-tts-play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-tts-play-btn:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 166, 81, 0.3); }
.ai-tts-play-btn:disabled { opacity: 0.7; cursor: wait; }

.voice-filter-bar { display: flex; gap: 0.5rem; margin-bottom: 1rem; }

.voice-filter-btn {
    padding: 0.5rem 1rem;
    background: var(--background-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all var(--transition);
}

.voice-filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.voice-filter-btn.active { background: rgba(0, 166, 81, 0.15); border-color: var(--primary); color: var(--primary); }

.voice-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--border-light); border-radius: var(--border-radius); margin-bottom: 1rem; }
.voice-list::-webkit-scrollbar { width: 6px; }
.voice-list::-webkit-scrollbar-track { background: var(--background-secondary); }
.voice-list::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }
.voice-loading { padding: 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

.voice-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-light); cursor: pointer; transition: all var(--transition); }
.voice-item:last-child { border-bottom: none; }
.voice-item:hover { background: rgba(0, 166, 81, 0.05); }
.voice-item.active { background: rgba(0, 166, 81, 0.1); border-right: 3px solid var(--primary); }

.voice-item-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; flex-shrink: 0; }
.voice-item-icon.male { background: rgba(51, 153, 255, 0.15); color: var(--secondary); }
.voice-item-icon.female { background: rgba(236, 72, 153, 0.15); color: #ec4899; }
.voice-item-info { flex: 1; min-width: 0; }
.voice-item-name { font-size: 0.85rem; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-item-lang { font-size: 0.7rem; color: var(--text-muted); }
.voice-item-badge { font-size: 0.65rem; padding: 0.2rem 0.5rem; border-radius: 10px; background: rgba(0, 166, 81, 0.15); color: var(--primary); white-space: nowrap; }

.voice-test-area { display: flex; gap: 0.75rem; align-items: center; }
.voice-test-area input { flex: 1; padding: 0.6rem 0.75rem; background: var(--background-secondary); border: 1px solid var(--border-light); border-radius: var(--border-radius); color: var(--text); font-family: inherit; font-size: 0.85rem; }
.voice-test-area input:focus { border-color: var(--primary); outline: none; }

.typing-input-area { margin-bottom: 1.5rem; }

.typing-input-area textarea {
    width: 100%;
    padding: 1.25rem;
    background: var(--background-secondary);
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius);
    color: var(--text);
    font-family: 'Inter', monospace;
    font-size: 1.1rem;
    line-height: 1.8;
    resize: vertical;
    min-height: 120px;
    transition: border-color var(--transition);
}

.typing-input-area textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.2); }

.typing-actions { display: flex; gap: 1rem; margin-top: 1rem; }

.action-btn { padding: 0.6rem 1.25rem; border-radius: var(--border-radius); border: none; cursor: pointer; font-weight: 600; font-family: inherit; font-size: 0.875rem; display: flex; align-items: center; gap: 0.5rem; transition: all var(--transition); }
.reset-btn { background: var(--background-elevated); color: var(--text-muted); border: 1px solid var(--border-light); }
.reset-btn:hover { border-color: var(--primary); color: var(--primary); }
.finish-btn { background: var(--primary-gradient); color: white; }
.finish-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-primary); }

.typing-result { background: var(--background-elevated); border: 1px solid var(--border-light); border-radius: var(--border-radius-lg); padding: 2rem; text-align: center; }
.typing-result h3 { color: var(--accent); margin-bottom: 1.5rem; font-size: 1.5rem; }
.typing-result h3 i { margin-left: 0.5rem; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.result-item { background: var(--background-secondary); padding: 1.25rem; border-radius: var(--border-radius); border: 1px solid var(--border-light); }
.result-value { font-size: 2rem; font-weight: 800; color: var(--primary); }
.result-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

.vocab-container { background: var(--glass-bg); backdrop-filter: var(--glass-backdrop); border-radius: var(--border-radius-lg); padding: 2rem; border: 1px solid var(--glass-border); }
.vocab-controls { display: flex; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; align-items: center; }
.vocab-controls select { padding: 0.6rem 1rem; background: var(--background-elevated); border: 1px solid var(--border-light); border-radius: var(--border-radius); color: var(--text); font-family: inherit; font-size: 0.875rem; cursor: pointer; }
.vocab-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.vocab-placeholder { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 3rem; color: var(--text-muted); }
.vocab-placeholder i { font-size: 2.5rem; color: var(--primary); opacity: 0.5; }
.vocab-placeholder p { margin: 0; }

.vocab-card { background: var(--background-elevated); border: 1px solid var(--border-light); border-radius: var(--border-radius); padding: 1.5rem; transition: all var(--transition); position: relative; overflow: hidden; }
.vocab-card::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 3px; background: var(--primary-gradient); }
.vocab-card:hover { transform: translateY(-5px); border-color: rgba(0, 166, 81, 0.3); box-shadow: var(--shadow-primary); }

.vocab-word { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin-bottom: 0.25rem; font-family: 'Inter', sans-serif; direction: ltr; text-align: left; }
.vocab-phonetic { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.75rem; font-family: 'Inter', sans-serif; direction: ltr; text-align: left; }
.vocab-meaning { color: var(--text-light); margin-bottom: 0.5rem; font-size: 0.9rem; }
.vocab-example { font-style: italic; color: var(--text-secondary); font-size: 0.85rem; direction: ltr; text-align: left; border-right: 3px solid var(--primary); padding-right: 0.75rem; margin-bottom: 0.75rem; }
.vocab-card-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.vocab-translations { margin-bottom: 0.75rem; padding: 0.5rem 0; }
.vocab-translations .translation-item { padding: 0.35rem 0; border-bottom: 1px solid var(--border-light); }
.vocab-translations .translation-item:last-child { border-bottom: none; }

.vocab-action-btn { background: rgba(0, 166, 81, 0.1); border: 1px solid rgba(0, 166, 81, 0.2); color: var(--primary); padding: 0.4rem 0.75rem; border-radius: var(--border-radius); cursor: pointer; font-size: 0.75rem; transition: all var(--transition); font-family: inherit; }
.vocab-action-btn:hover { background: rgba(0, 166, 81, 0.2); }

.grammar-container { background: var(--glass-bg); backdrop-filter: var(--glass-backdrop); border-radius: var(--border-radius-lg); padding: 2rem; border: 1px solid var(--glass-border); }
.grammar-controls { display: flex; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; align-items: center; }
.grammar-controls select { padding: 0.6rem 1rem; background: var(--background-elevated); border: 1px solid var(--border-light); border-radius: var(--border-radius); color: var(--text); font-family: inherit; font-size: 0.875rem; cursor: pointer; }
.grammar-content { min-height: 200px; }
.grammar-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 3rem; color: var(--text-muted); }
.grammar-placeholder i { font-size: 2.5rem; color: var(--primary); opacity: 0.5; }
.grammar-placeholder p { margin: 0; }

.grammar-exercise { background: var(--background-elevated); border-radius: var(--border-radius); padding: 2rem; border: 1px solid var(--border-light); }
.grammar-exercise h4 { color: var(--primary); margin-bottom: 1rem; }
.grammar-exercise .explanation { background: rgba(0, 166, 81, 0.1); border: 1px solid rgba(0, 166, 81, 0.2); border-radius: var(--border-radius); padding: 1rem; margin-bottom: 1.5rem; color: var(--text-light); font-size: 0.9rem; direction: ltr; text-align: left; line-height: 1.8; }

.grammar-question { background: var(--background-secondary); border: 1px solid var(--border-light); border-radius: var(--border-radius); padding: 1.25rem; margin-bottom: 1rem; direction: ltr; text-align: left; }
.grammar-question p { color: var(--text-light); margin-bottom: 0.75rem; font-size: 1rem; }
.grammar-options { display: flex; flex-direction: column; gap: 0.5rem; }

.grammar-option { padding: 0.6rem 1rem; background: var(--background-elevated); border: 1px solid var(--border-light); border-radius: var(--border-radius); cursor: pointer; transition: all var(--transition); color: var(--text); font-family: inherit; font-size: 0.9rem; text-align: left; }
.grammar-option:hover { border-color: var(--primary); background: rgba(0, 166, 81, 0.1); }
.grammar-option.correct { border-color: var(--success); background: rgba(34, 197, 94, 0.15); color: var(--success); }
.grammar-option.incorrect { border-color: var(--danger); background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.grammar-option.disabled { pointer-events: none; opacity: 0.7; }

.chat-container { background: var(--glass-bg); backdrop-filter: var(--glass-backdrop); border-radius: var(--border-radius-lg); border: 1px solid var(--glass-border); overflow: hidden; display: flex; flex-direction: column; max-height: 700px; }

.chat-header { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.5rem; background: var(--background-elevated); border-bottom: 1px solid var(--border-light); }
.chat-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-gradient); display: flex; align-items: center; justify-content: center; color: white; font-size: 1.1rem; }
.chat-info h4 { margin: 0; font-size: 0.9rem; color: var(--text); }
.online-status { font-size: 0.75rem; color: var(--success); }
.chat-actions { margin-right: auto; display: flex; align-items: center; gap: 0.75rem; }
.chat-action-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0.5rem; border-radius: var(--border-radius); transition: all var(--transition); }
.chat-action-btn:hover { background: rgba(255, 255, 255, 0.1); color: var(--danger); }
.chat-actions select { padding: 0.4rem 0.75rem; background: var(--background-secondary); border: 1px solid var(--border-light); border-radius: var(--border-radius); color: var(--text); font-family: inherit; font-size: 0.8rem; }

.chat-messages { flex: 1; overflow-y: auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; min-height: 400px; max-height: 500px; }
.message { display: flex; gap: 0.75rem; animation: fadeInUp 0.3s ease; }
.message-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; flex-shrink: 0; }
.ai-message .message-avatar { background: var(--primary-gradient); color: white; }
.user-message .message-avatar { background: var(--secondary); color: white; }
.message-content { background: var(--background-elevated); border: 1px solid var(--border-light); border-radius: var(--border-radius); padding: 1rem 1.25rem; max-width: 80%; direction: ltr; text-align: left; }
.message-content p { color: var(--text-light); margin-bottom: 0.5rem; font-size: 0.9rem; }
.message-content p:last-child { margin-bottom: 0; }
.message-content ul { padding-left: 1.25rem; padding-right: 0; margin-bottom: 0; }
.message-content li { font-size: 0.85rem; color: var(--text-muted); }
.user-message { flex-direction: row-reverse; }
.user-message .message-content { background: rgba(0, 166, 81, 0.15); border-color: rgba(0, 166, 81, 0.3); }

.chat-input-area { display: flex; gap: 0.75rem; padding: 1rem 1.5rem; border-top: 1px solid var(--border-light); background: var(--background-elevated); }
.chat-input-area textarea { flex: 1; padding: 0.75rem 1rem; background: var(--background-secondary); border: 1px solid var(--border-light); border-radius: var(--border-radius); color: var(--text); font-family: 'Inter', sans-serif; font-size: 0.9rem; resize: none; max-height: 100px; transition: border-color var(--transition); }
.chat-input-area textarea:focus { border-color: var(--primary); outline: none; }

.send-btn { background: var(--primary-gradient); color: white; border: none; width: 42px; height: 42px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all var(--transition); flex-shrink: 0; }
.send-btn:hover { transform: scale(1.1); box-shadow: var(--shadow-primary); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.language-options { margin-top: 1rem; }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.75rem; margin-bottom: 1.5rem; }
.lang-option { cursor: pointer; }
.lang-option input { display: none; }
.lang-card { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; padding: 1rem 0.75rem; background: var(--background-elevated); border: 2px solid var(--border-light); border-radius: var(--border-radius); transition: all var(--transition); text-align: center; }
.lang-card:hover { border-color: rgba(0, 166, 81, 0.4); transform: translateY(-2px); }
.lang-option input:checked + .lang-card { border-color: var(--primary); background: rgba(0, 166, 81, 0.1); box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.15); }
.lang-flag { font-size: 1.75rem; }
.lang-name { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.lang-example { font-size: 0.7rem; color: var(--text-muted); font-style: italic; }

.custom-lang-section { background: var(--background-elevated); border: 1px solid var(--border-light); border-radius: var(--border-radius); padding: 1.25rem; margin-top: 1rem; }
.custom-lang-section h4 { color: var(--primary); font-size: 0.9rem; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.custom-lang-form { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.custom-lang-form input { padding: 0.5rem 0.75rem; background: var(--background-secondary); border: 1px solid var(--border-light); border-radius: var(--border-radius); color: var(--text); font-family: inherit; font-size: 0.85rem; flex: 1; min-width: 140px; transition: border-color var(--transition); }
.custom-lang-form input:focus { border-color: var(--primary); outline: none; }
.custom-langs-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.custom-lang-tag { display: flex; align-items: center; gap: 0.5rem; background: rgba(0, 166, 81, 0.1); border: 1px solid rgba(0, 166, 81, 0.3); padding: 0.4rem 0.75rem; border-radius: 20px; font-size: 0.8rem; color: var(--primary-light); }
.custom-lang-tag button { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 0.75rem; padding: 0; line-height: 1; transition: opacity var(--transition); }
.custom-lang-tag button:hover { opacity: 0.7; }

.translation-block { margin-top: 2.5rem; padding: 1.25rem; background: linear-gradient(135deg, var(--background-elevated) 0%, rgba(0,166,81,0.03) 100%); border: 1px solid var(--border-light); border-radius: 12px; direction: rtl; text-align: right; border-top: 3px solid var(--primary); }
.translation-header { display: flex; align-items: center; gap: 0.5rem; color: var(--primary); font-weight: 600; font-size: 0.9rem; margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border-light); }
.translation-header i { font-size: 1.1rem; }
.translation-lang-section { margin-bottom: 1rem; padding: 1rem; background: var(--background); border-radius: 8px; border: 1px solid var(--border-light); transition: border-color 0.2s; }
.translation-lang-section:hover { border-color: var(--primary-light); }
.translation-lang-section:last-child { margin-bottom: 0; }
.translation-lang-badge { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.7rem; background: var(--primary); color: white; border-radius: 20px; font-size: 0.75rem; font-weight: 600; margin-bottom: 0.75rem; }
.translation-text { color: var(--text-light); font-size: 0.88rem; line-height: 1.8; padding: 0.25rem 0; }
.translation-dialogue { display: flex; flex-direction: column; gap: 0.6rem; }
.translation-dialogue-line { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.5rem 0.75rem; background: var(--background-elevated); border-radius: 8px; border-right: 3px solid var(--primary); transition: transform 0.15s, background 0.15s; }
.translation-dialogue-line:hover { transform: translateX(-2px); background: rgba(0, 166, 81, 0.05); }
.translation-dialogue-line:nth-child(even) { border-right-color: var(--secondary, #2196F3); }
.dialogue-speaker { font-weight: 700; color: var(--primary); font-size: 0.8rem; white-space: nowrap; min-width: fit-content; }
.translation-dialogue-line:nth-child(even) .dialogue-speaker { color: var(--secondary, #2196F3); }
.dialogue-text { color: var(--text-light); font-size: 0.85rem; line-height: 1.6; }
.translation-line { color: var(--text-light); font-size: 0.85rem; line-height: 1.6; padding: 0.25rem 0; }
.typing-text-content { margin-bottom: 0; }
.translation-item { padding: 0.5rem 0; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; gap: 0.75rem; }
.translation-item:last-child { border-bottom: none; }
.translation-item .lang-label { font-size: 0.75rem; color: var(--text-muted); min-width: 70px; font-weight: 600; }
.translation-item .lang-text { color: var(--text-light); font-size: 0.85rem; }

.settings-container { display: grid; gap: 2rem; max-width: 800px; margin: 0 auto; }
.settings-card { background: var(--glass-bg); backdrop-filter: var(--glass-backdrop); border-radius: var(--border-radius-lg); padding: 2rem; border: 1px solid var(--glass-border); }
.settings-card-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.settings-card-header i { font-size: 1.5rem; color: var(--primary); }
.settings-card-header h3 { margin: 0; color: var(--text); font-size: 1.25rem; }
.settings-description { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

.api-input-area textarea { width: 100%; padding: 1rem; background: var(--background-secondary); border: 2px solid var(--border-light); border-radius: var(--border-radius); color: var(--text); font-family: 'Inter', monospace; font-size: 0.85rem; line-height: 1.8; resize: vertical; min-height: 150px; transition: border-color var(--transition); }
.api-input-area textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.15); }
.api-actions { display: flex; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }

.save-btn, .test-btn { padding: 0.6rem 1.25rem; border-radius: var(--border-radius); border: none; cursor: pointer; font-weight: 600; font-family: inherit; font-size: 0.875rem; display: flex; align-items: center; gap: 0.5rem; transition: all var(--transition); }
.save-btn { background: var(--primary-gradient); color: white; }
.save-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-primary); }
.test-btn { background: var(--background-elevated); color: var(--secondary); border: 1px solid var(--secondary); }
.test-btn:hover { background: rgba(51, 153, 255, 0.1); }

.api-status { margin-top: 1rem; padding: 0.75rem 1rem; border-radius: var(--border-radius); font-size: 0.85rem; display: none; }
.api-status.success { display: block; background: rgba(34, 197, 94, 0.15); border: 1px solid rgba(34, 197, 94, 0.3); color: var(--success); }
.api-status.error { display: block; background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); color: var(--danger); }
.api-status.loading { display: block; background: rgba(14, 165, 233, 0.15); border: 1px solid rgba(14, 165, 233, 0.3); color: var(--info); }
.api-keys-count { margin-top: 1rem; display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-muted); }
.api-keys-count i { color: var(--info); }

.settings-options { display: flex; flex-direction: column; gap: 1.25rem; }
.setting-item { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 0; border-bottom: 1px solid var(--border-light); }
.setting-item:last-child { border-bottom: none; }
.setting-item label:first-child { color: var(--text-light); font-size: 0.9rem; }
.setting-item select { padding: 0.4rem 0.75rem; background: var(--background-elevated); border: 1px solid var(--border-light); border-radius: var(--border-radius); color: var(--text); font-family: inherit; font-size: 0.85rem; }
.setting-item input[type="range"] { width: 120px; accent-color: var(--primary); }
.setting-item span { font-size: 0.8rem; color: var(--primary); min-width: 35px; }

.toggle { position: relative; display: inline-block; width: 48px; height: 26px; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--border-light); border-radius: 26px; transition: all var(--transition); }
.toggle-slider::before { content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: white; top: 3px; right: 3px; transition: all var(--transition); }
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(-22px); }

.security-info { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.security-item { display: flex; align-items: flex-start; gap: 1rem; padding: 1rem; background: var(--background-elevated); border-radius: var(--border-radius); border: 1px solid var(--border-light); }
.security-item i { font-size: 1.25rem; color: var(--primary); margin-top: 0.25rem; }
.security-item strong { display: block; color: var(--text); margin-bottom: 0.25rem; font-size: 0.9rem; }
.security-item p { margin: 0; font-size: 0.8rem; color: var(--text-muted); }

.danger-btn { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); color: var(--danger); padding: 0.6rem 1.25rem; border-radius: var(--border-radius); cursor: pointer; font-weight: 600; font-family: inherit; font-size: 0.85rem; display: flex; align-items: center; gap: 0.5rem; transition: all var(--transition); }
.danger-btn:hover { background: rgba(239, 68, 68, 0.25); }

.main-footer { background: rgba(0, 0, 0, 0.9); padding: 4rem 0 1rem; border-top: 1px solid rgba(0, 166, 81, 0.2); }
.footer-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 3rem; margin-bottom: 3rem; }
.footer-section h3 { color: var(--primary); margin-bottom: 1.5rem; font-size: 1.125rem; font-weight: 700; }
.footer-logo { display: flex; align-items: center; gap: 0.75rem; color: var(--primary); font-size: 1.25rem; font-weight: 800; margin-bottom: 1rem; }
.footer-logo i { color: var(--accent); }
.footer-description { color: var(--text-muted); line-height: 1.6; }
.footer-title { color: var(--primary); margin-bottom: 1.5rem; font-size: 1.125rem; font-weight: 700; }
.footer-links { list-style: none; padding: 0; }
.footer-links li { margin-bottom: 0.75rem; }
.footer-links a { color: var(--text-muted); text-decoration: none; display: flex; align-items: center; gap: 0.5rem; transition: color var(--transition); }
.footer-links a:hover { color: var(--primary); }

.footer-bottom { text-align: center; padding-top: 2rem; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.footer-bottom-content { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.copyright, .footer-brand { color: var(--text-muted); }
.footer-brand a { color: var(--primary); font-weight: 600; }
.footer-brand i { color: var(--danger); }

.toast { position: fixed; bottom: 20px; left: 20px; padding: 1rem 1.5rem; border-radius: var(--border-radius); background: var(--success); color: white; box-shadow: var(--shadow-xl); z-index: 1000; opacity: 0; transform: translateX(-100%); transition: all 0.3s ease; display: flex; align-items: center; gap: 1rem; max-width: 400px; }
.toast.show { opacity: 1; transform: translateX(0); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--info); }
.toast-content { display: flex; align-items: center; gap: 0.75rem; flex-grow: 1; }
.toast-icon { font-size: 1.125rem; }
.toast-close { background: rgba(255, 255, 255, 0.2); border: none; color: white; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }

.loading-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(5px); z-index: 1001; display: none; align-items: center; justify-content: center; }
.loading-overlay.show { display: flex; }
.loading-spinner { text-align: center; }
.spinner { width: 50px; height: 50px; border: 4px solid var(--border-light); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 1rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-spinner p { color: var(--text-muted); font-size: 0.9rem; }

.floating-buttons { position: fixed; right: 1rem; bottom: 1rem; z-index: 90; }
.float-button { background: var(--primary-gradient); color: white; width: 45px; height: 45px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--shadow); transition: all var(--transition); border: none; }
.float-button:hover { transform: scale(1.1); box-shadow: var(--shadow-primary); }

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

@media (max-width: 1024px) { .hero-stats { gap: 2rem; } .typing-stats-bar { gap: 0.5rem; } }

@media (max-width: 768px) {
    .nav-links { display: none; }
    .mobile-menu-toggle { display: flex; }
    .header-content { padding: 0 1rem; }
    .header-lang-select select { font-size: 0.75rem; padding: 0.3rem 0.4rem; }
    .container { padding: 0 1rem; }
    .section { padding: 3rem 0; }
    .hero-section { padding: 5rem 0 1rem; }
    .hero-section .hero-subtitle { font-size: 0.85rem; }
    .hero-title { font-size: clamp(2rem, 8vw, 3rem); }
    .hero-stats { gap: 1.5rem; }
    .stat-item { flex-direction: column; text-align: center; }
    .lang-buttons { gap: 0.5rem; }
    .lang-select-btn { min-width: 75px; padding: 0.6rem 0.75rem; font-size: 0.7rem; }
    .lang-flag-big { font-size: 1.4rem; }
    .typing-stats-bar { flex-wrap: wrap; }
    .stat-box { min-width: 80px; padding: 0.5rem 0.75rem; }
    .stat-box span { font-size: 1rem; }
    .text-display-area { padding: 1.25rem; font-size: 1rem; }
    .audio-controls { flex-direction: column; align-items: stretch; }
    .speed-control { margin-right: 0; }
    .vocab-cards { grid-template-columns: 1fr; }
    .chat-messages { min-height: 300px; max-height: 400px; }
    .message-content { max-width: 90%; }
    .result-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-content { grid-template-columns: 1fr; gap: 2rem; }
    .footer-bottom-content { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
    .hero-actions { flex-direction: column; }
    .hero-btn { width: 100%; justify-content: center; }
    .typing-container, .vocab-container, .grammar-container, .settings-card { padding: 1.25rem; }
    .stat-box { min-width: 60px; }
    .vocab-controls { flex-direction: column; align-items: stretch; }
    .grammar-controls { flex-direction: column; align-items: stretch; }
    .lang-select-btn { min-width: 65px; padding: 0.5rem; }
    .lang-flag-big { font-size: 1.2rem; }
    .dictation-container, .flashcard-container, .quiz-container { padding: 1.25rem; }
    .flashcard-card { min-height: 200px; }
    .rating-buttons { flex-wrap: wrap; }
    .rating-btn { flex: 1; min-width: 70px; font-size: 0.75rem; padding: 0.6rem 0.4rem; }
    .quiz-option-btn { padding: 0.9rem 1rem; font-size: 0.9rem; }
}

@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ============================================
   DASHBOARD
   ============================================ */
.dash-overview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.dash-card { background: var(--background-card); border: 1px solid var(--border); border-radius: var(--border-radius-lg); padding: 1.25rem; text-align: center; transition: all var(--transition); }
.dash-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.dash-card-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
.dash-card-value { font-size: 1.75rem; font-weight: 800; margin-bottom: 0.25rem; }
.dash-card-label { font-size: 0.8rem; color: var(--text-muted); }
.streak-card .dash-card-icon { color: #f59e0b; }
.streak-card .dash-card-value { color: #f59e0b; }
.xp-card .dash-card-icon { color: var(--primary); }
.xp-card .dash-card-value { color: var(--primary); }
.level-card .dash-card-icon { color: var(--accent); }
.level-card .dash-card-value { color: var(--accent); font-size: 1.2rem; }
.today-card .dash-card-icon { color: var(--secondary); }
.today-card .dash-card-value { color: var(--secondary); }

.dash-level-progress { background: var(--background-card); border: 1px solid var(--border); border-radius: var(--border-radius); padding: 1rem 1.25rem; margin-bottom: 1.5rem; }
.level-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; font-size: 0.85rem; }
.level-info span:first-child { font-weight: 700; color: var(--primary); }
.level-info span:last-child { color: var(--text-muted); font-size: 0.75rem; }
.level-bar { height: 10px; background: var(--background-elevated); border-radius: 5px; overflow: hidden; }
.level-bar-fill { height: 100%; background: var(--primary-gradient); border-radius: 5px; transition: width 0.5s ease; }

.dash-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.chart-container { background: var(--background-card); border: 1px solid var(--border); border-radius: var(--border-radius-lg); padding: 1.25rem; }
.chart-container h3 { font-size: 0.9rem; color: var(--text); margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; }
.chart-container h3 i { color: var(--primary); }
.chart-container canvas { width: 100%; height: 180px; }

.dash-achievements { background: var(--background-card); border: 1px solid var(--border); border-radius: var(--border-radius-lg); padding: 1.25rem; margin-bottom: 1.5rem; }
.dash-achievements h3 { font-size: 1rem; color: var(--text); margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.dash-achievements h3 i { color: var(--accent); }
.achievements-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.75rem; }
.achievement-badge { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; padding: 1rem 0.5rem; border-radius: var(--border-radius); text-align: center; transition: all var(--transition); }
.achievement-badge i { font-size: 1.5rem; }
.achievement-badge .ach-name { font-size: 0.8rem; font-weight: 700; }
.achievement-badge .ach-desc { font-size: 0.7rem; color: var(--text-muted); }
.achievement-badge.unlocked { background: rgba(0, 166, 81, 0.1); border: 1px solid var(--primary); }
.achievement-badge.unlocked i { color: var(--primary); }
.achievement-badge.locked { background: var(--background-elevated); border: 1px solid var(--border); opacity: 0.5; }
.achievement-badge.locked i { color: var(--text-muted); }

.dash-export { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.dash-export .generate-btn:last-child { background: var(--background-elevated); color: var(--text-muted); border: 1px solid var(--border); }

/* Keyboard Heatmap */
.dash-heatmap { background: var(--background-card); border-radius: 12px; padding: 1.5rem; border: 1px solid var(--border); }
.dash-heatmap h3 { margin-bottom: 0.5rem; color: var(--text); font-size: 1rem; }
.heatmap-desc { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1rem; }
.heatmap-keyboard { display: flex; flex-direction: column; align-items: center; gap: 6px; direction: ltr; }
.heatmap-row { display: flex; gap: 4px; justify-content: center; }
.heatmap-key { width: 38px; height: 38px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 600; background: var(--background-elevated); color: var(--text); border: 1px solid var(--border); transition: all 0.3s ease; position: relative; }
.heatmap-key.space-key { width: 180px; }
.heatmap-key .error-count { position: absolute; top: -6px; right: -6px; background: var(--danger); color: #fff; font-size: 0.6rem; width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; }
.heatmap-key.heat-1 { background: rgba(245,158,11,0.2); border-color: rgba(245,158,11,0.5); color: #f59e0b; }
.heatmap-key.heat-2 { background: rgba(249,115,22,0.3); border-color: rgba(249,115,22,0.6); color: #f97316; }
.heatmap-key.heat-3 { background: rgba(239,68,68,0.3); border-color: rgba(239,68,68,0.6); color: #ef4444; }
.heatmap-key.heat-4 { background: rgba(239,68,68,0.5); border-color: rgba(239,68,68,0.8); color: #fff; box-shadow: 0 0 8px rgba(239,68,68,0.4); }
.heatmap-legend { display: flex; gap: 1rem; margin-top: 1rem; justify-content: center; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-muted); }
.legend-box { width: 16px; height: 16px; border-radius: 4px; }
.legend-box.legend-low { background: rgba(245,158,11,0.3); border: 1px solid rgba(245,158,11,0.5); }
.legend-box.legend-mid { background: rgba(249,115,22,0.4); border: 1px solid rgba(249,115,22,0.6); }
.legend-box.legend-high { background: rgba(239,68,68,0.5); border: 1px solid rgba(239,68,68,0.8); }
.heatmap-reset-btn { margin-top: 1rem; font-size: 0.8rem; padding: 0.5rem 1rem; background: var(--background-elevated); color: var(--text-muted); border: 1px solid var(--border); }

/* Sound toggle */
.sound-toggle { position: fixed; bottom: 80px; left: 20px; width: 40px; height: 40px; border-radius: 50%; background: var(--background-card); border: 1px solid var(--border); color: var(--text-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 100; transition: all 0.3s ease; }
.sound-toggle:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.sound-toggle.muted { opacity: 0.5; }

/* Combo System */
.combo-box { background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(239,68,68,0.1)) !important; border-color: rgba(245,158,11,0.4) !important; }
.combo-box span { color: #f59e0b !important; font-weight: 800; }
.combo-box.combo-active { animation: comboPulse 0.5s ease; }
.combo-box.combo-high span { color: #ef4444 !important; }
.combo-box.combo-max span { color: #a855f7 !important; text-shadow: 0 0 8px rgba(168,85,247,0.5); }
@keyframes comboPulse { 0% { transform: scale(1); } 50% { transform: scale(1.15); } 100% { transform: scale(1); } }
.combo-popup { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 3rem; font-weight: 900; color: #f59e0b; pointer-events: none; z-index: 9999; animation: comboPopup 0.8s ease forwards; text-shadow: 0 0 20px rgba(245,158,11,0.5); }
@keyframes comboPopup { 0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); } 50% { transform: translate(-50%, -50%) scale(1.3); } 100% { opacity: 0; transform: translate(-50%, -80%) scale(1); } }

/* Speed Rush */
.rush-intro { text-align: center; padding: 1rem 0; }
.rush-icon { font-size: 2.5rem; color: #f59e0b; margin-bottom: 0.75rem; animation: rushGlow 2s ease infinite; }
@keyframes rushGlow { 0%, 100% { text-shadow: 0 0 5px rgba(245,158,11,0.3); } 50% { text-shadow: 0 0 20px rgba(245,158,11,0.8); } }
.rush-intro h3 { font-size: 1.3rem; color: var(--text); margin-bottom: 0.5rem; }
.rush-settings { display: flex; gap: 1rem; justify-content: center; margin: 1rem 0; flex-wrap: wrap; }
.rush-start-btn { background: linear-gradient(135deg, #f59e0b, #ef4444) !important; font-size: 1.1rem; padding: 0.75rem 2rem !important; }
.rush-start-btn:hover { box-shadow: 0 0 20px rgba(245,158,11,0.4); }
.rush-timer-bar { width: 100%; height: 6px; background: var(--background-elevated); border-radius: 3px; overflow: hidden; margin-bottom: 1rem; }
.rush-timer-fill { height: 100%; background: linear-gradient(90deg, #22c55e, #f59e0b, #ef4444); border-radius: 3px; transition: width 0.1s linear; width: 100%; }
.rush-hud { display: flex; justify-content: center; gap: 2rem; padding: 1rem; flex-wrap: wrap; }
.rush-stat { text-align: center; }
.rush-stat span { display: block; font-size: 2rem; font-weight: 800; color: var(--text); }
.rush-stat label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }
.rush-stat.combo-stat span { color: #f59e0b; }
.rush-result { text-align: center; padding: 1rem 0; }
.rush-result-header { font-size: 1.5rem; font-weight: 700; color: #f59e0b; margin-bottom: 1.5rem; }
.rush-result-header i { margin-left: 0.5rem; }
.rush-result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.rush-result-item { background: var(--background-elevated); padding: 1rem; border-radius: 10px; border: 1px solid var(--border); }
.rush-result-item span { display: block; font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.rush-result-item label { font-size: 0.75rem; color: var(--text-muted); }

.msn-card-dash { background: linear-gradient(135deg, rgba(0,166,81,0.15), rgba(0,166,81,0.05)); border-color: var(--primary) !important; }
.msn-card-dash i { color: var(--primary) !important; }

@media (max-width: 768px) {
    .dash-overview { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .dash-charts { grid-template-columns: 1fr; }
    .achievements-grid { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
    .achievement-badge { padding: 0.75rem 0.25rem; }
    .achievement-badge i { font-size: 1.2rem; }
    .dash-card-value { font-size: 1.4rem; }
    .heatmap-key { width: 28px; height: 28px; font-size: 0.65rem; }
    .heatmap-key.space-key { width: 120px; }
    .heatmap-key .error-count { width: 14px; height: 14px; font-size: 0.5rem; top: -4px; right: -4px; }
}

@media (max-width: 480px) {
    .achievements-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
   MOBILE SECTION NAVIGATOR
   ============================================ */
.mobile-section-nav { display: none; }
.mobile-back-bar { display: none; }

@media (max-width: 768px) {
    .mobile-section-nav { display: block; padding: 1.5rem 1rem; padding-top: calc(var(--header-height) + 1.rem); }
    .msn-header { text-align: center; margin-bottom: 1.25rem; }
    .msn-header h2 {
        font-size: 1.25rem;
        color: var(--text);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        margin: 0;
        margin-top: 1rem;
    }






    .msn-header h2 i { color: var(--primary); }
    .msn-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .msn-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem; padding: 1.25rem 0.75rem; background: var(--background-card); border: 1px solid var(--border); border-radius: var(--border-radius-lg); cursor: pointer; transition: all var(--transition); font-family: inherit; color: var(--text); min-height: 90px; }
    .msn-card i { font-size: 1.5rem; color: var(--primary); }
    .msn-card span { font-size: 0.85rem; font-weight: 600; }
    .msn-card:active { transform: scale(0.96); background: rgba(0, 166, 81, 0.1); border-color: var(--primary); }

    .mobile-back-bar { position: sticky; top: var(--header-height); z-index: 50; background: var(--glass-bg); backdrop-filter: var(--glass-backdrop); border-bottom: 1px solid var(--border); padding: 0.6rem 1rem; display: flex; align-items: center; gap: 0.75rem; }
    .mobile-back-btn { background: var(--background-elevated); border: 1px solid var(--border); border-radius: var(--border-radius); padding: 0.5rem 0.9rem; color: var(--text); font-family: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 0.4rem; transition: all var(--transition); }
    .mobile-back-btn:active { background: var(--primary); color: white; border-color: var(--primary); }
    .mobile-section-title { font-size: 0.9rem; font-weight: 700; color: var(--primary); }

    body.msn-active .hero-section { display: none !important; }
    body.msn-active .main-footer { display: none; }
    body.msn-active .mobile-section-nav { display: none; }
    .msn-hidden { display: none !important; }
    .msn-visible { display: block !important; }

    .main-content > section.section { display: none; }
    body:not(.msn-active) .mobile-section-nav { display: block; }
    body:not(.msn-active) .hero-section { display: block; }
    body.msn-active .mobile-back-bar { display: flex !important; }
}

@media (min-width: 769px) {
    .mobile-section-nav { display: none !important; }
    .mobile-back-bar { display: none !important; }
    .main-content > section.section { display: block !important; }
}

/* ============================================
   TYPING CONTROLS TABS
   ============================================ */
.tc-tabs { display: flex; gap: 4px; margin-bottom: 1.25rem; background: var(--background-elevated); border-radius: var(--border-radius); padding: 4px; }
.tc-tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.7rem 0.75rem; border: none; border-radius: 8px; background: transparent; color: var(--text-muted); font-family: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all var(--transition); white-space: nowrap; }
.tc-tab:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.tc-tab.active { background: var(--primary-gradient); color: white; box-shadow: 0 2px 8px rgba(0, 166, 81, 0.3); }
.tc-tab i { font-size: 0.8rem; }
.tc-panel { display: none; animation: fadeInUp 0.25s ease; }
.tc-panel.active { display: block; }
.tc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.tc-generate-btn { width: 100%; margin-top: 0.5rem; }
.tc-panel-desc { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.tc-panel textarea { width: 100%; padding: 0.75rem; background: var(--background-elevated); border: 1px solid var(--border); border-radius: var(--border-radius); color: var(--text); font-family: inherit; font-size: 0.9rem; resize: vertical; margin-bottom: 0.75rem; }
.tc-panel textarea:focus { outline: none; border-color: var(--primary); }
.tc-manual-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tc-manual-actions .generate-btn { flex: 1; min-width: 140px; }

@media (max-width: 768px) {
    .tc-tabs { gap: 2px; padding: 3px; }
    .tc-tab { padding: 0.6rem 0.5rem; font-size: 0.75rem; }
    .tc-tab span { display: inline; }
    .tc-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
}

@media (max-width: 480px) {
    .tc-grid { grid-template-columns: 1fr; }
    .tc-manual-actions { flex-direction: column; }
    .tc-manual-actions .generate-btn { min-width: unset; }
}

/* ============================================
   LIGHT THEME
   ============================================ */
html[data-theme="light"] {
    --background: #f8f9fa;
    --background-secondary: #ffffff;
    --background-tertiary: #f0f2f5;
    --background-card: #ffffff;
    --background-elevated: #f5f7fa;
    --text: #1a1a2e;
    --text-muted: #555555;
    --text-light: #333333;
    --text-secondary: #666666;
    --border: #e2e8f0;
    --border-light: #cbd5e1;
    --border-lighter: #94a3b8;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.15);
    --shadow-primary: 0 8px 25px rgba(0, 166, 81, 0.15);
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] body { background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 50%, #f0f2f5 100%); }
html[data-theme="light"] body::before { background: radial-gradient(circle at 20% 20%, rgba(0, 166, 81, 0.04) 0%, transparent 50%), radial-gradient(circle at 80% 80%, rgba(51, 153, 255, 0.03) 0%, transparent 50%); }
html[data-theme="light"] .main-header { background: rgba(255, 255, 255, 0.95); border-bottom-color: rgba(0, 0, 0, 0.08); }
html[data-theme="light"] .main-footer { background: rgba(255, 255, 255, 0.98); border-top-color: rgba(0, 166, 81, 0.15); }
html[data-theme="light"] .settings-card, html[data-theme="light"] .typing-container, html[data-theme="light"] .vocab-container, html[data-theme="light"] .grammar-container, html[data-theme="light"] .chat-container, html[data-theme="light"] .dictation-container, html[data-theme="light"] .flashcard-container, html[data-theme="light"] .quiz-container { background: rgba(255, 255, 255, 0.9); border-color: var(--border); }
html[data-theme="light"] .vocab-card { background: rgba(245, 247, 250, 0.8); border-color: var(--border); }
html[data-theme="light"] .text-display-area { background: rgba(245, 247, 250, 0.9); border-color: var(--border); }
html[data-theme="light"] .chat-messages { background: rgba(245, 247, 250, 0.5); }
html[data-theme="light"] .message.ai-message .message-content { background: rgba(0, 166, 81, 0.08); }
html[data-theme="light"] .mobile-menu-content { background: #ffffff; }

/* ============================================
   THEME TOGGLE BUTTON
   ============================================ */
.theme-toggle { background: rgba(255, 255, 255, 0.1); border: 1px solid var(--glass-border); border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text); transition: all var(--transition); font-size: 0.9rem; }
.theme-toggle:hover { background: rgba(255, 215, 0, 0.2); transform: scale(1.1); }
#themeIconMoon { display: none; }

/* ============================================
   DICTATION MODULE
   ============================================ */
.dictation-container { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--border-radius-lg); padding: 2rem; backdrop-filter: var(--glass-backdrop); }
.dictation-controls { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1.5rem; }
.dictation-play-area { text-align: center; }
.dictation-hint { background: rgba(14, 165, 233, 0.1); border: 1px solid rgba(14, 165, 233, 0.2); border-radius: var(--border-radius); padding: 0.75rem 1.25rem; margin-bottom: 1.5rem; color: var(--info); display: flex; align-items: center; gap: 0.5rem; justify-content: center; font-size: 0.9rem; }
.dictation-audio-btns { display: flex; gap: 0.75rem; justify-content: center; margin-bottom: 1.5rem; flex-wrap: wrap; }
.dictation-plays-count { color: var(--text-muted); font-size: 0.8rem; display: flex; align-items: center; }
.dictation-input { width: 100%; min-height: 100px; padding: 1rem; background: var(--background-elevated); border: 1px solid var(--border); border-radius: var(--border-radius); color: var(--text); font-family: inherit; font-size: 1rem; resize: vertical; margin-bottom: 1rem; }
.dictation-input:focus { outline: none; border-color: var(--primary); }
.dictation-actions { display: flex; gap: 0.75rem; justify-content: center; }
.dictation-result { margin-top: 1.5rem; }
.dictation-score { text-align: center; margin-bottom: 1.5rem; }
.dictation-score span { font-size: 3rem; font-weight: 800; color: var(--primary); display: block; }
.dictation-score label { color: var(--text-muted); font-size: 0.9rem; }
.dictation-comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.comparison-box { background: var(--background-elevated); border: 1px solid var(--border); border-radius: var(--border-radius); padding: 1rem; }
.comparison-box h4 { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.comparison-box p { color: var(--text); font-size: 0.95rem; direction: ltr; text-align: left; margin: 0; }
.dictation-placeholder { text-align: center; padding: 3rem; color: var(--text-muted); }
.dictation-placeholder i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.3; display: block; }

/* ============================================
   FLASHCARDS MODULE
   ============================================ */
.flashcard-container { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--border-radius-lg); padding: 2rem; backdrop-filter: var(--glass-backdrop); }
.flashcard-stats-bar { display: flex; justify-content: center; gap: 2rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.fc-stat { text-align: center; }
.fc-stat i { color: var(--primary); margin-bottom: 0.25rem; display: block; }
.fc-stat span { font-size: 1.5rem; font-weight: 700; color: var(--text); display: block; }
.fc-stat label { font-size: 0.75rem; color: var(--text-muted); }
.flashcard-controls { display: flex; gap: 0.75rem; justify-content: center; margin-bottom: 1.5rem; flex-wrap: wrap; }
.flashcard-progress { text-align: center; margin-bottom: 1rem; color: var(--text-muted); font-size: 0.9rem; }
.flashcard-card { background: var(--background-elevated); border: 2px solid var(--border); border-radius: var(--border-radius-lg); min-height: 250px; display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; transition: transform 0.6s; transform-style: preserve-3d; margin-bottom: 1.5rem; }
.flashcard-card.flipped { transform: rotateY(180deg); }
.flashcard-front, .flashcard-back { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem; border-radius: var(--border-radius-lg); }
.flashcard-back { transform: rotateY(180deg); background: var(--background-card); }
.fc-word { font-size: 2rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
.fc-phonetic { font-size: 1rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.fc-tap-hint { font-size: 0.8rem; color: var(--text-secondary); margin-top: 1rem; opacity: 0.6; }
.fc-translation { font-size: 1.25rem; font-weight: 600; color: var(--primary); margin-bottom: 0.75rem; }
.fc-example { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1rem; text-align: center; }
.flashcard-rating { text-align: center; }
.flashcard-rating p { color: var(--text-muted); margin-bottom: 0.75rem; font-size: 0.9rem; }
.rating-buttons { display: flex; gap: 0.5rem; justify-content: center; }
.rating-btn { padding: 0.7rem 1.2rem; border: none; border-radius: var(--border-radius); cursor: pointer; font-family: inherit; font-weight: 600; font-size: 0.85rem; display: flex; align-items: center; gap: 0.4rem; transition: all var(--transition); color: white; }
.rating-btn.again { background: #ef4444; }
.rating-btn.hard { background: #f59e0b; }
.rating-btn.good { background: #3b82f6; }
.rating-btn.easy { background: #22c55e; }
.rating-btn:hover { transform: translateY(-2px); opacity: 0.9; }
.flashcard-placeholder { text-align: center; padding: 3rem; color: var(--text-muted); }
.flashcard-placeholder i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.3; display: block; }

/* ============================================
   QUIZ MODULE
   ============================================ */
.quiz-container { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--border-radius-lg); padding: 2rem; backdrop-filter: var(--glass-backdrop); }
.quiz-setup-controls { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }
.quiz-header-bar { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.quiz-progress-text { font-weight: 700; color: var(--primary); min-width: 50px; }
.quiz-progress-bar { flex: 1; height: 6px; background: var(--background-elevated); border-radius: 3px; overflow: hidden; }
.quiz-progress-fill { height: 100%; background: var(--primary-gradient); border-radius: 3px; transition: width 0.3s ease; }
.quiz-timer { font-weight: 600; color: var(--text-muted); font-size: 0.9rem; }
.quiz-question-box { background: var(--background-elevated); border: 1px solid var(--border); border-radius: var(--border-radius); padding: 1.5rem; margin-bottom: 1.5rem; }
.quiz-question-text { font-size: 1.1rem; font-weight: 600; color: var(--text); margin: 0; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.quiz-option-btn { background: var(--background-card); border: 2px solid var(--border); border-radius: var(--border-radius); padding: 1rem 1.25rem; color: var(--text); font-family: inherit; font-size: 0.95rem; cursor: pointer; transition: all var(--transition); text-align: right; }
.quiz-option-btn:hover:not(:disabled) { border-color: var(--primary); background: rgba(0, 166, 81, 0.05); }
.quiz-option-btn.correct { border-color: #22c55e; background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.quiz-option-btn.incorrect { border-color: #ef4444; background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.quiz-option-btn:disabled { cursor: default; }
.quiz-results { text-align: center; }
.quiz-results-header { margin-bottom: 1.5rem; }
.quiz-results-header i { font-size: 2.5rem; color: var(--accent); margin-bottom: 0.5rem; display: block; }
.quiz-score-display { margin-bottom: 1.5rem; }
.quiz-score-num { font-size: 4rem; font-weight: 800; color: var(--primary); }
.quiz-score-label { font-size: 1.5rem; color: var(--text-muted); }
.quiz-results-stats { display: flex; justify-content: center; gap: 2rem; margin-bottom: 2rem; flex-wrap: wrap; }
.qr-stat { text-align: center; }
.qr-stat i { font-size: 1.25rem; margin-bottom: 0.25rem; display: block; }
.qr-stat.correct i { color: #22c55e; }
.qr-stat.wrong i { color: #ef4444; }
.qr-stat.time i { color: var(--info); }
.qr-stat span { font-size: 1.5rem; font-weight: 700; display: block; color: var(--text); }
.qr-stat label { font-size: 0.75rem; color: var(--text-muted); }

/* ============================================
   VIRTUAL KEYBOARD
   ============================================ */
.virtual-keyboard-panel { position: fixed; bottom: 0; left: 0; right: 0; background: var(--background-card); border-top: 2px solid var(--border); padding: 0.75rem; z-index: 500; box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3); }
.vk-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; padding: 0 0.5rem; }
.vk-title { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.vk-actions { display: flex; gap: 0.5rem; }
.vk-case-btn, .vk-close-btn { background: var(--background-elevated); border: 1px solid var(--border); border-radius: 6px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text); font-size: 0.8rem; }
.vk-case-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.vk-keys { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.vk-row { display: flex; gap: 4px; justify-content: center; }
.vk-key { background: var(--background-elevated); border: 1px solid var(--border); border-radius: 6px; min-width: 32px; height: 38px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text); font-size: 0.9rem; font-family: inherit; transition: all 0.1s; padding: 0 8px; }
.vk-key:active { background: var(--primary); color: white; transform: scale(0.95); }
.vk-key.vk-wide { min-width: 120px; font-size: 0.8rem; gap: 0.4rem; }
.vk-special-row { margin-top: 4px; }
.vk-toggle-btn { margin-top: 0.5rem; }

/* ============================================
   NOTIFICATION & CACHE SETTINGS
   ============================================ */
.notification-settings { display: flex; flex-direction: column; gap: 1rem; }
.notification-status { font-size: 0.8rem; margin: 0; }
.cache-settings { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.cache-stats { color: var(--text-muted); font-size: 0.9rem; }

/* ============================================
   MOBILE IMPROVEMENTS
   ============================================ */
@media (max-width: 768px) {
    .generate-btn, .action-btn, .audio-btn { min-height: 44px; font-size: 0.85rem; padding: 0.65rem 1rem; }
    select, input[type="text"], input[type="number"], input[type="time"], textarea { font-size: 16px !important; min-height: 44px; }
    .send-btn { min-width: 44px; min-height: 44px; }
    .quiz-options { grid-template-columns: 1fr; }
    .dictation-comparison { grid-template-columns: 1fr; }
    .virtual-keyboard-panel { padding: 0.5rem; }
    .vk-key { min-width: 28px; height: 34px; font-size: 0.8rem; }
    .nav-links { font-size: 0.75rem; }
    .nav-links li a { padding: 0.4rem 0.5rem; }
}

