diff --git "a/index.html" "b/index.html" --- "a/index.html" +++ "b/index.html" @@ -22,6 +22,10 @@ --neural-muted: #8a8aff; --neural-glow: 0 0 40px rgba(0, 243, 255, 0.5); --neural-pulse: 0 0 80px rgba(157, 0, 255, 0.3); + --trini-green: #00a859; + --trini-red: #da291c; + --trini-black: #000000; + --trini-white: #ffffff; --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); } @@ -121,6 +125,27 @@ 100% { transform: translateX(100%); } } + /* === TRINI THEME OVERLAY === */ + .trini-overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: -1; + opacity: 0; + pointer-events: none; + transition: opacity 1s ease; + background: + radial-gradient(circle at 20% 30%, rgba(0, 168, 89, 0.1) 0%, transparent 50%), + radial-gradient(circle at 80% 70%, rgba(218, 41, 28, 0.1) 0%, transparent 50%), + linear-gradient(135deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 168, 89, 0.1) 25%, rgba(218, 41, 28, 0.1) 50%, rgba(0, 168, 89, 0.1) 75%, rgba(0, 0, 0, 0.3) 100%); + } + + .trini-overlay.active { + opacity: 0.7; + } + /* === MAIN CONTAINER === */ .app-container { max-width: 1800px; @@ -223,11 +248,14 @@ display: flex; flex-direction: column; gap: 35px; + overflow-y: auto; + max-height: 85vh; } @media (max-width: 1400px) { .neural-sidebar { position: static; + max-height: none; } } @@ -259,6 +287,96 @@ filter: drop-shadow(0 0 8px currentColor); } + /* === SIDEBAR TOGGLE === */ + .sidebar-toggle { + position: fixed; + top: 20px; + left: 20px; + z-index: 1000; + background: rgba(16, 16, 37, 0.9); + border: 1px solid rgba(0, 243, 255, 0.3); + color: var(--neural-primary); + width: 50px; + height: 50px; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + font-size: 1.5rem; + transition: var(--transition); + box-shadow: var(--neural-glow); + } + + .sidebar-toggle:hover { + transform: scale(1.1); + box-shadow: 0 0 30px rgba(0, 243, 255, 0.5); + } + + /* === SESSION DURATION SLIDER === */ + .session-slider-container { + margin: 20px 0; + } + + .slider-label { + display: flex; + justify-content: space-between; + margin-bottom: 10px; + color: var(--neural-text); + font-family: 'Rajdhani', sans-serif; + font-weight: 600; + } + + .slider-value { + color: var(--neural-primary); + font-family: 'Orbitron', sans-serif; + } + + .session-slider { + width: 100%; + height: 12px; + -webkit-appearance: none; + appearance: none; + background: rgba(26, 26, 58, 0.8); + border-radius: 6px; + outline: none; + } + + .session-slider::-webkit-slider-thumb { + -webkit-appearance: none; + appearance: none; + width: 24px; + height: 24px; + border-radius: 50%; + background: var(--neural-primary); + cursor: pointer; + border: 2px solid var(--neural-text); + box-shadow: 0 0 15px rgba(0, 243, 255, 0.5); + } + + .session-slider::-moz-range-thumb { + width: 24px; + height: 24px; + border-radius: 50%; + background: var(--neural-primary); + cursor: pointer; + border: 2px solid var(--neural-text); + box-shadow: 0 0 15px rgba(0, 243, 255, 0.5); + } + + .slider-ticks { + display: flex; + justify-content: space-between; + margin-top: 8px; + padding: 0 10px; + } + + .tick { + color: var(--neural-muted); + font-size: 0.8rem; + font-family: 'Rajdhani', sans-serif; + } + /* === FORM ELEMENTS === */ .neural-input-group { margin-bottom: 25px; @@ -775,6 +893,108 @@ display: block; } + /* === FIREWORKS ANIMATION === */ + .fireworks-container { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + pointer-events: none; + z-index: 1000; + display: none; + } + + .firework { + position: absolute; + width: 4px; + height: 4px; + border-radius: 50%; + box-shadow: 0 0 20px currentColor; + animation: fireworkExplode 1.5s ease-out forwards; + } + + @keyframes fireworkExplode { + 0% { + transform: translate(var(--x), var(--y)) scale(0); + opacity: 1; + } + 20% { + transform: translate(var(--x), var(--y)) scale(1); + } + 100% { + transform: translate( + calc(var(--x) + var(--dx) * 100px), + calc(var(--y) + var(--dy) * 100px) + ) scale(0); + opacity: 0; + } + } + + /* === BALLOONS ANIMATION === */ + .balloons-container { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + pointer-events: none; + z-index: 1000; + display: none; + } + + .balloon { + position: absolute; + bottom: -100px; + width: 60px; + height: 80px; + border-radius: 50%; + animation: balloonFloat 8s ease-in forwards; + } + + .balloon::before { + content: ''; + position: absolute; + bottom: -20px; + left: 50%; + transform: translateX(-50%); + width: 2px; + height: 40px; + background: rgba(255, 255, 255, 0.5); + } + + @keyframes balloonFloat { + 0% { + transform: translateY(0) rotate(0deg); + opacity: 1; + } + 100% { + transform: translateY(-120vh) rotate(20deg); + opacity: 0; + } + } + + /* === STREAK DISPLAY === */ + .streak-container { + display: flex; + align-items: center; + gap: 10px; + margin-top: 10px; + } + + .streak-dot { + width: 15px; + height: 15px; + border-radius: 50%; + background: var(--neural-muted); + transition: var(--transition); + } + + .streak-dot.active { + background: var(--neural-success); + box-shadow: 0 0 10px var(--neural-success); + } + /* === TOAST === */ .toast-container { position: fixed; @@ -1119,6 +1339,51 @@ font-family: 'Exo 2', sans-serif; } + /* === CERTIFICATE === */ + .certificate { + background: linear-gradient(135deg, rgba(16, 16, 37, 0.9), rgba(26, 26, 58, 0.9)); + border-radius: 30px; + padding: 60px; + text-align: center; + border: 3px solid var(--neural-primary); + box-shadow: var(--neural-glow); + position: relative; + overflow: hidden; + } + + .certificate::before { + content: ''; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: url('data:image/svg+xml,'); + opacity: 0.3; + } + + .certificate-title { + font-family: 'Orbitron', sans-serif; + font-size: 3rem; + color: var(--neural-primary); + margin-bottom: 30px; + text-shadow: 0 0 30px rgba(0, 243, 255, 0.5); + } + + .certificate-subtitle { + font-family: 'Rajdhani', sans-serif; + font-size: 1.5rem; + color: var(--neural-muted); + margin-bottom: 50px; + } + + .certificate-stats { + display: grid; + grid-template-columns: repeat(3, 1fr); + gap: 30px; + margin: 50px 0; + } + /* === LOADING === */ .neural-loader { display: inline-block; @@ -1276,6 +1541,18 @@
+ + +
+ + +
+
+ + +
@@ -1290,76 +1567,126 @@
+ + +
+ +
-

NEURAL SPELLING TRAINER

-

AI-Powered Vocabulary Mastery â€ĸ Google TTS Engine â€ĸ Neural Learning Protocol

+

NEURAL SPELLING TRAINER

+

AI-Powered Vocabulary Mastery â€ĸ Google TTS Engine â€ĸ Neural Learning Protocol

-
- +
_ _ _ _ _ _ _ _
- Initializing neural learning protocol... + Loading training session...
-
+
- +
- Neural hint: Press [ENTER] to submit or [TAB] for neural assistance + Press [ENTER] to submit or [TAB] for hint
@@ -1540,31 +1883,17 @@
-

Neural Performance Matrix

+

Performance

-
-
-
Optimal
-
72%
-
-
-
-
Assisted
-
18%
-
-
-
-
Recalibrating
-
10%
-
+
-

Neural Achievements

+

Achievements

@@ -1572,7 +1901,7 @@
-

Recent Lexical Processing

+

Recent Words

@@ -1580,7 +1909,7 @@
-

Neural Milestones

+

Milestones

@@ -1593,33 +1922,33 @@
-

Neural Voice Laboratory

+

Voice Testing

- +
- +
-
Temporal Rate
+
Speed
1.0x
-
Frequency Modulation
+
Pitch
1.0
@@ -1629,19 +1958,11 @@
-

Neural Voice Repository

+

Voice Gallery

- - -
-

Acoustic Analysis

-
- -
-
@@ -1650,62 +1971,68 @@
-

Training Parameters

+

Game Settings

+
+
+
- +
-

Acoustic Parameters

+

Audio Settings

- +
- +
- +
80%
@@ -1713,19 +2040,19 @@
-

Neural Data Management

+

Data Management

@@ -1741,43 +2068,68 @@ const NeuralState = { // Core Training State currentWordIndex: 0, - totalWords: 15, + totalWords: 20, score: 0, streak: 0, attempts: 0, hintsUsed: 0, currentWord: "", currentContext: "", + currentDefinition: "", maskedWord: "", revealedLetters: 0, isCorrect: false, isFirstTry: true, startTime: null, sessionTime: 0, + wordStartTime: null, + wordTime: 0, + contextClickCount: 0, + + // Training Mode State + trainingMode: 'sequential', + difficultyLevel: 'grade1', + sessionLength: 20, + + // Adaptive Mode State + adaptiveLevel: 'basic', + adaptiveLevels: ['basic', 'intermediate', 'advanced', 'master', 'guru'], + adaptiveLevelThresholds: { + basic: 10, + intermediate: 8, + advanced: 6, + master: 4, + guru: 2 + }, + adaptiveProgress: { + basic: { correct: 0, total: 0 }, + intermediate: { correct: 0, total: 0 }, + advanced: { correct: 0, total: 0 }, + master: { correct: 0, total: 0 }, + guru: { correct: 0, total: 0 } + }, // TTS Engine Configuration ttsEngine: 'google', googleApiKey: localStorage.getItem('googleApiKey') || '', - googleVoice: localStorage.getItem('googleVoice') || 'en-US-Neural2-F', + googleVoice: localStorage.getItem('googleVoice') || 'en-US-Neural2-A', edgeVoice: 'en-US-AriaNeural', speechRate: 1.0, speechPitch: 1.0, speechVolume: 0.8, isSpeaking: false, - // User Neural Profile + // User Profile userName: localStorage.getItem('userName') || 'Neural Learner', - userLevel: localStorage.getItem('userLevel') || 'initiate', + userRank: localStorage.getItem('userRank') || 'INITIATE', userXP: parseInt(localStorage.getItem('userXP')) || 0, // Lexical Database - wordLists: { - grade1: [], grade2: [], grade3: [], grade4: [], grade5: [], grade6: [], - sentence1: [], sentence2: [], sentence3: [], time: [], trini: [] - }, + wordLists: {}, currentWordList: [], + shuffledWordList: [], - // Neural Performance Metrics + // Performance Metrics performance: { totalSessions: parseInt(localStorage.getItem('totalSessions')) || 0, totalWordsCompleted: parseInt(localStorage.getItem('totalWordsCompleted')) || 0, @@ -1786,30 +2138,1319 @@ incorrect: parseInt(localStorage.getItem('incorrect')) || 0, totalTime: parseInt(localStorage.getItem('totalTime')) || 0, longestStreak: parseInt(localStorage.getItem('longestStreak')) || 0, + bestStreakToday: 0, + fastestWord: null, currentStreak: 0 }, - // Neural Achievement Matrix - badges: [ - { id: 1, name: "Perfect 10", description: "10 perfect sequential units", earned: false, icon: "🔟", rarity: "common" }, - { id: 2, name: "Lexical Explorer", description: "50 lexical units mastered", earned: false, icon: "🧭", rarity: "common" }, - { id: 3, name: "Neural Accelerator", description: "<30s average per unit", earned: false, icon: "⚡", rarity: "uncommon" }, - { id: 4, name: "Precision Master", description: "90%+ neural accuracy", earned: false, icon: "đŸŽ¯", rarity: "rare" }, - { id: 5, name: "Flawless Session", description: "100% session accuracy", earned: false, icon: "💎", rarity: "epic" }, - { id: 6, name: "Vocabulary Architect", description: "100 units mastered", earned: false, icon: "đŸ›ī¸", rarity: "legendary" }, - { id: 7, name: "Consecutive Mastery", description: "20+ perfect streak", earned: false, icon: "đŸ”Ĩ", rarity: "rare" }, - { id: 8, name: "Unaided Achievement", description: "Session without assistance", earned: false, icon: "đŸ’Ē", rarity: "uncommon" }, - { id: 9, name: "Temporal Dominance", description: "<15s average per unit", earned: false, icon: "âąī¸", rarity: "epic" }, - { id: 10, name: "Neural Consistency", description: "7-day learning streak", earned: false, icon: "📅", rarity: "rare" } - ], - - // Neural Memory Cache + // Session History + recentWords: [], + sessionHistory: [], history: JSON.parse(localStorage.getItem('wordHistory')) || [], - sessionHistory: [] + + // Settings + settings: JSON.parse(localStorage.getItem('settings')) || { + autoPlay: true, + soundEffects: true, + animations: true, + hintsEnabled: true, + spellOutEnabled: true, + difficultyAdjustment: 'auto' + }, + + // Timed Mode + timedMode: false, + timePerWord: 60, + wordTimer: null, + + // Trini Mode + triniMode: false + }; + + // ========== SOUND EFFECTS ========== + class SoundManager { + constructor() { + this.audioContext = null; + this.sounds = {}; + this.volume = 0.8; + } + + init() { + try { + this.audioContext = new (window.AudioContext || window.webkitAudioContext)(); + this.loadDefaultSounds(); + } catch (e) { + console.warn('Web Audio API not supported:', e); + } + } + + loadDefaultSounds() { + // Create simple synthesized sounds as fallback + this.createSound('perfect', this.createBeepSound(800, 0.3, 'sine')); + this.createSound('correct', this.createBeepSound(600, 0.2, 'sine')); + this.createSound('incorrect', this.createBeepSound(300, 0.3, 'square')); + this.createSound('trini', this.createBeepSound(523.25, 0.5, 'sine')); // C5 note + } + + createBeepSound(frequency, duration, type = 'sine') { + return (context, volume) => { + const oscillator = context.createOscillator(); + const gainNode = context.createGain(); + + oscillator.connect(gainNode); + gainNode.connect(context.destination); + + oscillator.frequency.value = frequency; + oscillator.type = type; + + gainNode.gain.setValueAtTime(0, context.currentTime); + gainNode.gain.linearRampToValueAtTime(volume, context.currentTime + 0.1); + gainNode.gain.exponentialRampToValueAtTime(0.001, context.currentTime + duration); + + oscillator.start(context.currentTime); + oscillator.stop(context.currentTime + duration); + }; + } + + createSound(name, soundFunction) { + this.sounds[name] = soundFunction; + } + + play(name) { + if (!NeuralState.settings.soundEffects || !this.audioContext) return; + + try { + const sound = this.sounds[name]; + if (sound && this.audioContext.state === 'suspended') { + this.audioContext.resume(); + } + if (sound) { + sound(this.audioContext, this.volume); + } + } catch (e) { + console.warn('Failed to play sound:', e); + } + } + + setVolume(volume) { + this.volume = Math.max(0, Math.min(1, volume)); + } + } + + const soundManager = new SoundManager(); + + // ========== VISUAL EFFECTS ========== + class VisualEffects { + static createFireworks(x, y, count = 30) { + const container = document.getElementById('fireworksContainer'); + container.innerHTML = ''; + container.style.display = 'block'; + + const colors = ['#00f3ff', '#9d00ff', '#ff00ff', '#00ff9d', '#ffd600']; + + for (let i = 0; i < count; i++) { + const firework = document.createElement('div'); + firework.className = 'firework'; + + const angle = Math.random() * Math.PI * 2; + const distance = Math.random() * 0.8 + 0.2; + const dx = Math.cos(angle) * distance; + const dy = Math.sin(angle) * distance; + const color = colors[Math.floor(Math.random() * colors.length)]; + + firework.style.setProperty('--x', `${x}px`); + firework.style.setProperty('--y', `${y}px`); + firework.style.setProperty('--dx', dx); + firework.style.setProperty('--dy', dy); + firework.style.backgroundColor = color; + firework.style.color = color; + + container.appendChild(firework); + + setTimeout(() => { + firework.remove(); + }, 1500); + } + + setTimeout(() => { + container.style.display = 'none'; + }, 1500); + } + + static createBalloons(count = 15) { + const container = document.getElementById('balloonsContainer'); + container.innerHTML = ''; + container.style.display = 'block'; + + const colors = ['#00f3ff', '#9d00ff', '#ff00ff', '#00ff9d', '#ffd600', '#ff006e']; + + for (let i = 0; i < count; i++) { + const balloon = document.createElement('div'); + balloon.className = 'balloon'; + + const left = Math.random() * 90 + 5; + const color = colors[Math.floor(Math.random() * colors.length)]; + const delay = Math.random() * 2; + const duration = 6 + Math.random() * 4; + + balloon.style.left = `${left}%`; + balloon.style.backgroundColor = color; + balloon.style.animationDelay = `${delay}s`; + balloon.style.animationDuration = `${duration}s`; + + container.appendChild(balloon); + + setTimeout(() => { + balloon.remove(); + }, (delay + duration) * 1000); + } + + setTimeout(() => { + container.style.display = 'none'; + }, 10000); + } + + static createStreakVisualization(count) { + const container = document.getElementById('streakDots'); + container.innerHTML = ''; + + for (let i = 0; i < 10; i++) { + const dot = document.createElement('div'); + dot.className = 'streak-dot'; + if (i < count) { + dot.classList.add('active'); + } + container.appendChild(dot); + } + } + } + + // ========== FILE SYSTEM AND DATA LOADING ========== + const fileSystem = { + 'lists/grade1.txt': `cat|The cat sat on the mat. +dog|The dog ran in the yard. +sun|The sun is bright today. +moon|The moon shines at night. +hat|She wore a red hat. +ball|He threw the ball far. +tree|The tree is very tall. +fish|The fish swims fast. +bird|A bird sang loudly. +milk|I drink milk every day. +book|She read a book. +pen|He used a pen. +cup|The cup is full. +bed|I sleep in my bed. +toy|The toy is new. +shoe|My shoe is dirty. +door|Close the door. +cake|We ate cake. +rain|The rain fell softly. +snow|Snow is cold. +frog|A frog jumped. +leaf|The leaf fell down. +star|A star twinkles. +duck|The duck swims. +grass|The grass is green. +hand|Wash your hand. +foot|My foot hurts. +nose|Touch your nose. +face|Her face smiled. +eye|I see with my eye. +ear|My ear hears sounds. +red|The apple is red. +blue|The sky is blue. +pink|She likes pink. +big|The box is big. +small|The ant is small. +fast|He runs fast. +slow|The turtle is slow. +hot|The soup is hot. +cold|Ice is cold. +day|Today is a good day. +night|The night is dark. +up|Look up high. +down|Sit down now. +in|The toy is in the box. +out|Go out to play. +yes|She said yes. +no|He said no. +run|They run together. +jump|Jump over it. +walk|We walk home. +play|Children play outside. +eat|We eat lunch. +drink|Please drink water. +laugh|They laugh loudly. +cry|The baby will cry. +sleep|I sleep well. +wake|Wake up early. +help|Help your friend. +love|I love my family. +like|I like apples. +see|I see a bird. +hear|I hear music. +feel|I feel happy. +make|Make a tower. +look|Look at this. +find|Find the ball. +give|Give me one. +take|Take your bag. +come|Come here please. +go|Go home now. +stop|Stop right there. +start|Start the game. +open|Open the book. +close|Close the lid. +clean|Clean your room. +dirty|The floor is dirty. +happy|She feels happy. +sad|He feels sad. +fun|The game is fun. +kind|Be kind to others.`, + + 'lists/grade2.txt': `apple|She ate an apple. +banana|The banana is yellow. +orange|An orange is sweet. +grape|He picked a grape. +peach|The peach was juicy. +pear|The pear fell down. +chair|Sit on the chair. +table|The table is round. +window|Open the window. +mirror|She saw herself in the mirror. +pencil|Sharpen the pencil. +paper|Write on paper. +school|School starts early. +teacher|The teacher smiled. +student|Each student listened. +class|The class was quiet. +lesson|The lesson was easy. +story|He told a story. +letter|Mail the letter. +number|Write the number. +count|Count the stars. +shape|The shape is round. +circle|Draw a circle. +square|Make a square. +corner|Stand in the corner. +road|The road is long. +bridge|Cross the bridge. +river|The river flows. +mountain|The mountain is high. +valley|The valley is wide. +forest|The forest is green. +animal|The animal moved. +farm|The farm is busy. +tractor|The tractor is loud. +garden|The garden grew. +flower|The flower bloomed. +butterfly|A butterfly flew. +insect|The insect crawled. +spider|A spider spun a web. +honey|Bees make honey. +bread|Bake fresh bread. +cheese|The cheese melted. +butter|Spread the butter. +sugar|Add some sugar. +salt|Use less salt. +water|Drink clean water. +juice|Pour the juice. +breakfast|Breakfast was ready. +lunch|Lunch was packed. +dinner|Dinner smelled good. +family|Family matters. +parent|The parent waited. +child|The child played. +baby|The baby slept. +friendship|Friendship is important. +team|The team worked. +game|The game ended. +score|The score changed. +win|They win often. +lose|Sometimes you lose. +practice|Practice helps. +try|Try again. +build|Build a house. +fix|Fix the toy. +carry|Carry the bag. +push|Push gently. +pull|Pull the rope. +climb|Climb slowly. +slide|Slide down. +swing|Swing high. +throw|Throw carefully. +catch|Catch the ball. +balance|Keep balance. +careful|Be careful. +safe|Stay safe. +brave|She felt brave.`, + + 'lists/grade3.txt': `about|Tell me about your day. +above|The bird flew above the tree. +across|They walked across the street. +answer|She knew the answer. +around|The fence goes around the yard. +behind|The cat hid behind the couch. +between|The park is between two houses. +busy|The store was busy today. +carry|Please carry the box. +change|Change can be helpful. +children|The children played outside. +complete|Finish the work to complete it. +correct|Your answer is correct. +decide|Decide what to do next. +different|The twins look different. +during|He stayed quiet during class. +early|She arrived early. +example|The teacher gave an example. +excited|They felt excited inside. +explain|Explain your thinking. +follow|Follow the rules. +forward|Step forward slowly. +important|This rule is important. +inside|Stay inside today. +instead|Choose this instead. +learn|We learn new things. +listen|Please listen carefully. +maybe|Maybe it will rain. +minute|Wait a minute. +morning|The morning was calm. +natural|The park looks natural. +notice|Did you notice the sign? +number|Pick a number. +often|She often reads books. +outside|Play outside later. +pattern|The tiles form a pattern. +person|One person waited. +picture|The picture looks nice. +problem|Solve the problem. +question|Ask a question. +remember|Remember your homework. +sentence|Write a sentence. +separate|Keep them separate. +simple|The task was simple. +special|Today feels special. +suddenly|Suddenly it got quiet. +surface|The surface was smooth. +system|The system worked well. +teacher|The teacher explained clearly. +together|Work together as a team. +toward|Walk toward the door. +understand|I understand now. +usually|She usually smiles. +weather|The weather changed. +whole|Eat the whole apple. +without|Do not go without help. +almost|Almost finished. +better|This works better. +bring|Bring your bag. +build|Build a model. +caught|He caught the ball. +choose|Choose wisely. +clothes|The clothes are clean. +cover|Cover the food. +discover|Discover something new. +engine|The engine started. +favorite|Blue is my favorite. +field|The field is wide. +future|Think about the future. +happen|What will happen next? +island|The island is far away. +journey|The journey was long. +machine|The machine stopped. +matter|It does not matter. +moment|Wait a moment. +music|The music played softly. +planet|Earth is a planet. +present|Open the present. +quickly|She ran quickly. +reason|Give a reason. +result|The result surprised us. +shadow|A shadow followed him. +signal|The signal was clear. +travel|They travel often. +village|The village was quiet.`, + + 'lists/grade4.txt': `activity|The activity was fun. +adventure|The adventure was exciting. +agree|I agree with you. +ancient|They studied ancient ruins. +appear|Stars appear at night. +arrange|Arrange the chairs neatly. +attention|Pay close attention. +balance|Keep your balance. +behavior|His behavior improved. +belief|That belief is common. +breathe|Remember to breathe slowly. +calendar|Check the calendar. +category|Sort by category. +celebrate|They celebrate together. +compare|Compare the two answers. +condition|The condition improved. +consider|Consider all options. +continue|Continue your work. +describe|Describe what you see. +develop|Skills develop over time. +distance|The distance is long. +effect|The effect was noticeable. +energy|The body needs energy. +environment|Protect the environment. +equipment|The equipment was ready. +escape|The animal tried to escape. +exercise|Exercise is important. +experiment|The experiment worked. +familiar|The place felt familiar. +feature|This feature helps. +freedom|They value freedom. +function|The function failed. +government|The government announced changes. +history|History teaches lessons. +identify|Identify the problem. +improve|Practice will improve skills. +include|Include all details. +increase|Prices increase yearly. +independent|She worked independent of help. +information|Find more information. +instruction|Follow each instruction. +interest|He showed interest. +invent|Someone invents new tools. +language|Language changes over time. +material|The material feels rough. +measure|Measure the length. +method|This method works. +modern|Modern tools are helpful. +natural|The scene looked natural. +observe|Observe carefully. +opinion|Everyone has an opinion. +opposite|They stood opposite each other. +ordinary|It seemed ordinary. +organize|Organize your desk. +original|The idea was original. +participate|Participate in class. +pattern|Notice the pattern. +perform|They perform well. +persuade|Try to persuade kindly. +position|Change your position. +predict|Predict the outcome. +prevent|Rules prevent problems. +process|Trust the process. +protect|Protect your eyes. +purpose|Know your purpose. +recognize|I recognize that sound. +reduce|Reduce waste. +reflect|Reflect on learning. +region|The region is dry. +regular|Make regular visits. +require|This job may require effort. +resource|Water is a resource. +respond|Respond politely. +responsible|Be responsible. +result|The result was clear. +schedule|Follow the schedule. +section|Read this section. +select|Select one answer. +similar|The results are similar. +solution|Find a solution. +strategy|Use a strategy. +structure|The structure stood firm. +suggest|I suggest trying again. +support|Support your team. +symbol|The flag is a symbol. +temperature|The temperature rose. +tradition|The tradition continues. +transport|Transport goods safely. +variety|A variety was offered.`, + + 'lists/grade5.txt': `ability|She has the ability to learn quickly. +absorb|Plants absorb water from soil. +achieve|Work hard to achieve goals. +adjust|Adjust the volume carefully. +analyze|Analyze the results closely. +approach|Try a new approach. +argument|The argument remained calm. +assume|Do not assume the answer. +benefit|Exercise has health benefit. +challenge|The task was a challenge. +communicate|Communicate your ideas clearly. +complex|The puzzle was complex. +concentrate|Concentrate on the task. +conclude|Conclude after reviewing facts. +confidence|Confidence grows with practice. +conflict|Resolve the conflict peacefully. +consequence|Every action has consequence. +consistent|Be consistent with rules. +construct|Construct a strong model. +contribute|Contribute to the project. +coordinate|Coordinate the group effort. +creativity|Creativity inspires solutions. +critical|Think in a critical way. +demonstrate|Demonstrate the skill. +determine|Determine the cause. +developing|The idea is developing well. +dimension|Measure each dimension. +discussion|The discussion lasted long. +efficient|This method is efficient. +element|Oxygen is an element. +encourage|Encourage positive behavior. +evaluate|Evaluate the outcome. +evidence|Evidence supports the claim. +expand|Expand the explanation. +factor|Time is a factor. +flexible|Stay flexible during change. +formula|Use the correct formula. +foundation|Build a strong foundation. +generate|Generate new ideas. +impact|The impact was significant. +indicate|Results indicate success. +influence|Parents influence children. +initial|The initial step matters. +interpret|Interpret the data. +justify|Justify your answer. +logical|Use logical thinking. +maintain|Maintain good habits. +majority|The majority agreed. +methodical|Work in a methodical way. +modify|Modify the plan slightly. +neutral|Remain neutral in debate. +objective|The objective was clear. +option|Choose one option. +outcome|The outcome surprised us. +perspective|See another perspective. +predictable|The pattern was predictable. +priority|Safety is a priority. +procession|The procession moved slowly. +progress|Track your progress. +reaction|The reaction was quick. +reliable|The source is reliable. +represent|Charts represent data. +resolve|Resolve issues calmly. +resourceful|Be resourceful when needed. +responding|She is responding well. +significant|The change was significant. +structure|The structure held firm. +sufficient|This amount is sufficient. +theory|The theory was tested. +transfer|Transfer the files. +transform|Transform ideas into action. +unique|Each design is unique. +valid|The answer is valid. +variable|Control the variable.`, + + 'lists/grade6.txt': `abstract|The idea was abstract. +accurate|Provide accurate details. +advocate|Advocate for fairness. +alternative|Choose an alternative. +ambiguous|The message was ambiguous. +anticipate|Anticipate future needs. +articulate|Articulate your thoughts. +assess|Assess the situation. +authorize|Authorize the request. +bias|Recognize personal bias. +capacity|The tank reached capacity. +coherent|Write a coherent paragraph. +collaborate|Collaborate with peers. +compile|Compile the information. +comprehensive|Provide a comprehensive answer. +conceptual|Use conceptual thinking. +constraint|Time is a constraint. +controversy|The issue caused controversy. +criteria|Meet all criteria. +deduce|Deduce the meaning. +derive|Derive results logically. +distinct|The styles are distinct. +diverse|The group is diverse. +emphasis|Place emphasis on clarity. +equivalent|The values are equivalent. +establish|Establish clear rules. +ethical|Make ethical choices. +explicit|Be explicit in instructions. +facilitate|Facilitate discussion. +feasible|The plan is feasible. +framework|Build a framework. +fundamental|This skill is fundamental. +hypothesis|Test the hypothesis. +implement|Implement the strategy. +implicit|The meaning was implicit. +inevitable|Change is inevitable. +infrastructure|Improve infrastructure systems. +integrity|Act with integrity. +interpretation|Consider each interpretation. +justify|Justify your reasoning. +legitimate|The request was legitimate. +manipulate|Manipulate the variables. +maximize|Maximize efficiency. +methodology|Follow the methodology. +mitigate|Mitigate the risk. +notion|Challenge the notion. +objective|Remain objective. +optimize|Optimize performance. +parameter|Set the parameter. +phenomenon|Observe the phenomenon. +precede|The warning will precede action. +principle|Follow the principle. +proportion|Check the proportion. +qualitative|Use qualitative data. +quantitative|Collect quantitative data. +rationale|Explain the rationale. +refine|Refine the solution. +regulate|Regulate behavior. +relevant|Use relevant facts. +reliability|Ensure reliability. +scenario|Consider the scenario. +significance|Understand the significance. +simulate|Simulate the process. +specify|Specify requirements. +stability|Maintain stability. +strategy|Develop a strategy. +subsequent|Subsequent steps follow. +synthesize|Synthesize information. +systematic|Use a systematic approach. +theoretical|The model is theoretical. +threshold|Cross the threshold. +validity|Confirm validity. +variance|Measure variance. +viable|The option is viable.`, + + 'lists/sentence1.txt': `The cat sat on the mat.|Sentence 1 +I like to play outside.|Sentence 2 +She has a big red ball.|Sentence 3 +We go to school every day.|Sentence 4 +My dog runs very fast.|Sentence 5 +The sun is bright today.|Sentence 6 +He eats an apple for lunch.|Sentence 7 +They see a blue bird flying.|Sentence 8 +Mom reads a book at night.|Sentence 9 +The flower in the garden is yellow.|Sentence 10`, + + 'lists/sentence2.txt': `The children played outside in the park.|Sentence 1 +She quickly finished her homework before dinner.|Sentence 2 +The adventure was very exciting for everyone.|Sentence 3 +They celebrate birthdays with cake and games.|Sentence 4 +The teacher explained the lesson clearly to the class.|Sentence 5 +My favorite color is bright blue like the sky.|Sentence 6 +The weather changed suddenly this morning with rain.|Sentence 7 +We need to protect the environment for future generations.|Sentence 8 +My family traveled to a small village for vacation.|Sentence 9 +Exercise is important for good health and energy.|Sentence 10 +He discovered an ancient artifact in the field.|Sentence 11 +The science experiment produced interesting results.|Sentence 12 +She showed great courage during the difficult challenge.|Sentence 13 +The new machine functioned perfectly on its first test.|Sentence 14 +They observed the natural phenomenon with telescopes.|Sentence 15 +The government announced new rules for safety.|Sentence 16 +Practice will improve your skills over time.|Sentence 17 +The journey was long but enjoyable with friends.|Sentence 18 +He tried to solve the difficult math problem.|Sentence 19 +The information in the book was very helpful.|Sentence 20`, + + 'lists/sentence3.txt': `Scientists analyze data carefully to test their hypothesis.|Sentence 1 +Effective communication requires clear articulation of ideas.|Sentence 2 +The committee will evaluate all submitted proposals fairly.|Sentence 3 +Historical documents provide valuable evidence about the past.|Sentence 4 +Critical thinking helps solve complex problems systematically.|Sentence 5 +The engineer designed a sophisticated system for efficiency.|Sentence 6 +Students must demonstrate their understanding through examples.|Sentence 7 +The theory was supported by experimental results and data.|Sentence 8 +Global cooperation is essential for progress and peace.|Sentence 9 +The architect created an innovative structure for the city.|Sentence 10 +Scientific research contributes to our collective knowledge.|Sentence 11 +The natural phenomenon was observed systematically by researchers.|Sentence 12 +They developed a comprehensive strategy for the project.|Sentence 13 +Logical reasoning leads to valid conclusions and decisions.|Sentence 14 +The company implemented new procedures for safety.|Sentence 15 +Cultural diversity enriches our society with different perspectives.|Sentence 16 +The artist expressed profound emotions through her painting.|Sentence 17 +Technological advances transform industries and create jobs.|Sentence 18 +Environmental conservation protects ecosystems and biodiversity.|Sentence 19 +The scholar presented a compelling argument with evidence.|Sentence 20 +Mathematical formulas describe natural patterns in the universe.|Sentence 21 +The investigation revealed significant findings for science.|Sentence 22 +Effective leaders inspire their teams to achieve goals.|Sentence 23 +The process requires careful coordination between departments.|Sentence 24 +Literary analysis examines thematic elements in great detail.|Sentence 25 +Economic factors influence decision-making at all levels.|Sentence 26 +The discovery had profound implications for future research.|Sentence 27 +Scientific methodology ensures reliability in experiments.|Sentence 28 +The conference featured expert presentations on innovation.|Sentence 29 +Historical context explains social changes over centuries.|Sentence 30 +The project required extensive research and collaboration.|Sentence 31 +Innovative solutions address complex challenges creatively.|Sentence 32 +The system operated with maximum efficiency and precision.|Sentence 33 +Cultural traditions preserve community identity and heritage.|Sentence 34 +The analysis produced quantitative results for comparison.|Sentence 35 +Strategic planning anticipates future needs and opportunities.|Sentence 36 +The experiment confirmed the prediction made earlier.|Sentence 37 +Academic success requires consistent effort and dedication.|Sentence 38 +The framework supports multiple applications and uses.|Sentence 39 +Technological literacy is increasingly important in society.|Sentence 40 +The discussion explored various perspectives on the issue.|Sentence 41 +Scientific discovery drives human progress and understanding.|Sentence 42 +The evaluation considered multiple criteria for fairness.|Sentence 43 +Effective writing communicates ideas clearly to readers.|Sentence 44 +The model simulated real-world conditions accurately.|Sentence 45 +Historical research uncovers forgotten stories from the past.|Sentence 46 +The initiative promoted sustainable practices in agriculture.|Sentence 47 +Critical analysis strengthens arguments with solid evidence.|Sentence 48 +The system demonstrated remarkable stability under pressure.|Sentence 49 +Innovation transforms theoretical concepts into practical solutions.|Sentence 50`, + + 'lists/time.txt': `Monday|The first day of the school week. +Tuesday|Tuesday comes after Monday. +Wednesday|Wednesday is the middle of the week. +Thursday|Thursday comes before Friday. +Friday|Friday is the last school day. +Saturday|Saturday is a weekend day. +Sunday|Sunday is a day of rest. +January|The first month of the year. +February|February has twenty-eight days. +March|March comes after February. +April|April brings spring flowers. +May|May has thirty-one days. +June|June is the sixth month. +July|July is a summer month. +August|August comes after July. +September|September starts autumn. +October|October has thirty-one days. +November|November is before December. +December|December is the last month. +Time|Time measures moments and hours. +Clock|The clock shows the current time. +Watch|A watch tells time on your wrist. +Hour|An hour has sixty minutes. +Minute|A minute has sixty seconds. +Second|A second is a very short time. +Day|A day has twenty-four hours. +Week|A week has seven days. +Month|A month has about four weeks. +Year|A year has twelve months. +Decade|A decade is ten years. +Century|A century is one hundred years. +Millennium|A millennium is one thousand years. +Morning|Morning comes after sunrise. +Afternoon|Afternoon follows morning. +Evening|Evening comes before night. +Night|Night is when it is dark. +Dawn|Dawn is the first light of day. +Dusk|Dusk is the time after sunset. +Noon|Noon is twelve o'clock midday. +Midnight|Midnight is twelve o'clock at night. +Sunrise|Sunrise is when the sun appears. +Sunset|Sunset is when the sun disappears. +Calendar|A calendar shows days and months. +Schedule|A schedule plans activities by time. +Appointment|An appointment is a set meeting time. +Deadline|A deadline is the final time allowed. +Duration|Duration is how long something lasts. +Interval|An interval is time between events. +Moment|A moment is a very brief time. +Period|A period is a length of time. +Season|A season is a time of year. +Spring|Spring comes after winter. +Summer|Summer is the warmest season. +Autumn|Autumn comes after summer. +Winter|Winter is the coldest season. +Quarter|A quarter is three months. +Semester|A semester is half a school year. +Term|A term is a school period. +Holiday|A holiday is a special day off. +Vacation|Vacation is time away from work. +Weekend|The weekend includes Saturday and Sunday. +Weekday|A weekday is Monday through Friday. +Birthday|A birthday comes once each year. +Anniversary|An anniversary marks years passed. +Past|The past is time that has gone. +Present|The present is current time. +Future|The future is time yet to come. +Yesterday|Yesterday was the day before today. +Today|Today is the current day. +Tomorrow|Tomorrow will be the next day. +Now|Now is the present moment. +Soon|Soon means in a short time. +Later|Later means after some time. +Early|Early means before the expected time. +Late|Late means after the expected time. +Punctual|Punctual means being on time. +Tardy|Tardy means arriving late. +Schedule|A schedule organizes time. +Timetable|A timetable shows time arrangements. +Agenda|An agenda lists meeting topics. +Itinerary|An itinerary plans travel times. +Timeline|A timeline shows events in order. +Chronological|Chronological means in time order. +Simultaneous|Simultaneous means at the same time. +Concurrent|Concurrent means happening together. +Sequential|Sequential means in a time sequence. +Temporary|Temporary means for a limited time. +Permanent|Permanent means lasting forever. +Annual|Annual means once per year. +Monthly|Monthly means every month. +Weekly|Weekly means every week. +Daily|Daily means every day. +Hourly|Hourly means every hour. +Yearly|Yearly means each year. +Biannual|Biannual means twice per year. +Biennial|Biennial means every two years. +Centennial|Centennial means every hundred years. +Millennial|Millennial means every thousand years. +Epoch|An epoch is a period in history. +Era|An era is a long period of time. +Generation|A generation is about thirty years. +Lifetime|A lifetime is how long someone lives.`, + + 'lists/trini.txt': `Crime|Reducing crime is important for community safety. +Politics|Local politics influence national development. +Agenda|The government's agenda includes economic reforms. +Emergency|Call 999 in case of emergency situations. +Police|The police work to maintain public order. +Friends|Spending time with friends is part of Trini culture. +Family|Family gatherings often include traditional meals. +Island|Trinidad is the larger of the two islands. +Caricom|Trinidad is a founding member of Caricom. +Caribbean|Trinidad is located in the southern Caribbean. +African|African heritage influences music and Carnival. +Indian|Indian heritage contributes to food and festivals. +Chinese|The Chinese community adds to cultural diversity. +Diverse|Trinidad has a diverse multicultural population. +Pelau|Pelau is a popular one-pot Sunday dish. +Callaloo|Callaloo is made with dasheen leaves and okra. +Doubles|Doubles vendors are found throughout Trinidad. +Road|The Uriah Butler Highway is a major road. +Street|Charlotte Street in Port of Spain is busy. +Couva|Couva is a major town in central Trinidad. +Port of Spain|The capital city has many government buildings. +Tobago|Tobago is known for its beautiful beaches. +Scarborough|Scarborough is the capital of Tobago. +Driver|Taxi drivers provide transportation services. +Traffic|Traffic congestion occurs during rush hours. +Vehicle|Many types of vehicles use the highways. +License|Drivers must have a valid license. +Accident|Road accidents sometimes cause delays. +Hospital|The San Fernando General Hospital provides care. +Clinic|Health clinics serve local communities. +Doctor|Doctors work in both public and private sectors. +Nurse|Nurses provide essential healthcare services. +Medicine|Access to medicine is important for health. +School|Children attend school from age five. +Teacher|Teachers educate the nation's youth. +Student|Students study various subjects in school. +University|The University of the West Indies has a campus. +Education|Education is valued in Trinidadian society. +Business|Many people operate small businesses. +Market|The market sells fresh produce daily. +Money|Managing money wisely is important. +Bank|Banks provide financial services. +Account|People maintain bank accounts for savings. +Work|Many people work in various industries. +Job|Finding a good job can be challenging. +Salary|Workers receive their salary monthly. +Tax|Citizens pay taxes to the government. +Budget|The national budget is presented annually. +Economy|The economy includes oil and gas industries. +Oil|Oil production contributes to national revenue. +Gas|Natural gas is an important energy resource. +Petroleum|The petroleum industry employs many workers. +Refinery|The refinery processes crude oil. +Energy|Energy production powers the nation. +Electricity|Electricity reaches most households. +Water|Clean drinking water is essential. +Environment|Protecting the environment is crucial. +Pollution|Reducing pollution helps public health. +Recycling|Recycling conserves natural resources. +Waste|Proper waste management is necessary. +Community|Strong communities support each other. +Neighbor|Neighbors often help one another. +Village|Many people live in rural villages. +Town|Towns have shops and services. +City|Cities are centers of commerce and culture. +Building|New buildings are constructed regularly. +House|Families live in houses of various sizes. +Apartment|Apartments are common in urban areas. +Garden|Many homes have small gardens. +Yard|The yard is often used for gatherings. +Church|Churches are important for many communities. +Temple|Temples serve the Hindu community. +Mosque|Mosques serve the Muslim community. +Religion|Religious freedom is protected by law. +Faith|People of different faiths coexist peacefully. +Culture|Trinidadian culture is rich and vibrant. +Tradition|Traditional practices are passed down. +Music|Music is central to Trinidadian life. +Dance|Dancing is popular at celebrations. +Food|Trinidadian food is flavorful and diverse. +Recipe|Traditional recipes are shared among families. +Spice|Local dishes often include various spices. +Flavor|The flavor of Trini food is distinctive. +Restaurant|Restaurants serve local and international cuisine. +Beach|People enjoy visiting beaches on weekends. +Sea|The Caribbean Sea surrounds the islands. +Sun|The tropical sun shines brightly. +Rain|Rainfall is common during rainy season. +Weather|The weather is generally warm and humid. +Season|There are dry and rainy seasons. +Holiday|Public holidays are celebrated nationwide. +Celebration|Celebrations often involve food and music. +Party|Trinis love to have parties and fetes. +Invitation|People send invitations for special events. +Guest|Guests are always welcomed warmly. +Welcome|Trinis are known for their warm welcome. +Hospitality|Hospitality is an important cultural value. +Kindness|Showing kindness to others is valued. +Respect|Respect for elders is traditional. +Honesty|Honesty is important in relationships. +Responsibility|Taking responsibility is expected. +Discipline|Discipline helps achieve goals. +Success|Many Trinidadians achieve success abroad. +Carnival|Carnival is the biggest festival before Lent. +Diwali|Diwali is the Hindu Festival of Lights. +Eid|Eid marks the end of Ramadan for Muslims. +Christmas|Christmas is celebrated with pastelles and sorrel. +Easter|Easter commemorates the resurrection of Jesus. +Emancipation|Emancipation Day marks freedom from slavery. +Independence|Independence Day celebrates freedom from Britain. +Republic|Republic Day marks becoming a republic. +Labour|Labour Day honors workers' contributions. +Spiritual|Spiritual Baptist Liberation Day is observed. +Phagwah|Phagwah is the Hindu spring festival. +Indian|Indian Arrival Day commemorates Indian heritage. +Arrival|Indian Arrival Day is celebrated in May. +Baptist|Spiritual Baptist is an Afro-Christian religion. +Liberation|Spiritual Baptist Liberation Day is in March. +Ramadan|Ramadan is a month of fasting for Muslims. +Good Friday|Good Friday is a Christian holiday. +Easter Monday|Easter Monday follows Easter Sunday. +Boxing Day|Boxing Day is celebrated after Christmas. +New Year|New Year's Day starts the calendar year. +Whit Monday|Whit Monday is a Christian holiday. +Corpus Christi|Corpus Christi is a Catholic feast day.`, + + 'lists/adaptive.txt': `at|2-3 letters: Basic level +in|2-3 letters: Basic level +on|2-3 letters: Basic level +cat|2-3 letters: Basic level +dog|2-3 letters: Basic level +sun|2-3 letters: Basic level +moon|2-3 letters: Basic level +hat|2-3 letters: Basic level +ball|4-5 letters: Intermediate level +tree|4-5 letters: Intermediate level +fish|4-5 letters: Intermediate level +bird|4-5 letters: Intermediate level +milk|4-5 letters: Intermediate level +book|4-5 letters: Intermediate level +pen|2-3 letters: Basic level +cup|2-3 letters: Basic level +bed|2-3 letters: Basic level +toy|2-3 letters: Basic level +shoe|4-5 letters: Intermediate level +door|4-5 letters: Intermediate level +cake|4-5 letters: Intermediate level +rain|4-5 letters: Intermediate level +snow|4-5 letters: Intermediate level +frog|4-5 letters: Intermediate level +leaf|4-5 letters: Intermediate level +star|4-5 letters: Intermediate level +duck|4-5 letters: Intermediate level +grass|5 letters: Intermediate level +hand|4-5 letters: Intermediate level +foot|4-5 letters: Intermediate level +nose|4-5 letters: Intermediate level +face|4-5 letters: Intermediate level +eye|2-3 letters: Basic level +ear|2-3 letters: Basic level +red|2-3 letters: Basic level +blue|4-5 letters: Intermediate level +pink|4-5 letters: Intermediate level +big|2-3 letters: Basic level +small|5 letters: Intermediate level +fast|4-5 letters: Intermediate level +slow|4-5 letters: Intermediate level +hot|2-3 letters: Basic level +cold|4-5 letters: Intermediate level +day|2-3 letters: Basic level +night|5 letters: Intermediate level +up|2-3 letters: Basic level +down|4-5 letters: Intermediate level +in|2-3 letters: Basic level +out|2-3 letters: Basic level +yes|2-3 letters: Basic level +no|2-3 letters: Basic level +run|2-3 letters: Basic level +jump|4-5 letters: Intermediate level +walk|4-5 letters: Intermediate level +play|4-5 letters: Intermediate level +eat|2-3 letters: Basic level +drink|5 letters: Intermediate level +laugh|5 letters: Intermediate level +cry|2-3 letters: Basic level +sleep|5 letters: Intermediate level +wake|4-5 letters: Intermediate level +help|4-5 letters: Intermediate level +love|4-5 letters: Intermediate level +like|4-5 letters: Intermediate level +see|2-3 letters: Basic level +hear|4-5 letters: Intermediate level +feel|4-5 letters: Intermediate level +make|4-5 letters: Intermediate level +look|4-5 letters: Intermediate level +find|4-5 letters: Intermediate level +give|4-5 letters: Intermediate level +take|4-5 letters: Intermediate level +come|4-5 letters: Intermediate level +go|2-3 letters: Basic level +stop|4-5 letters: Intermediate level +start|5 letters: Intermediate level +open|4-5 letters: Intermediate level +close|5 letters: Intermediate level +clean|5 letters: Intermediate level +dirty|5 letters: Intermediate level +happy|5 letters: Intermediate level +sad|2-3 letters: Basic level +fun|2-3 letters: Basic level +kind|4-5 letters: Intermediate level +apple|5 letters: Intermediate level +chair|5 letters: Intermediate level +table|5 letters: Intermediate level +window|6 letters: Advanced level +mirror|6 letters: Advanced level +pencil|6 letters: Advanced level +paper|5 letters: Intermediate level +school|6 letters: Advanced level +teacher|7 letters: Advanced level +student|7 letters: Advanced level +class|5 letters: Intermediate level +lesson|6 letters: Advanced level +story|5 letters: Intermediate level +letter|6 letters: Advanced level +number|6 letters: Advanced level +count|5 letters: Intermediate level +shape|5 letters: Intermediate level +circle|6 letters: Advanced level +square|6 letters: Advanced level +corner|6 letters: Advanced level +road|4-5 letters: Intermediate level +bridge|6 letters: Advanced level +river|5 letters: Intermediate level +mountain|8 letters: Master level +valley|6 letters: Advanced level +forest|6 letters: Advanced level +animal|6 letters: Advanced level +farm|4-5 letters: Intermediate level +tractor|7 letters: Advanced level +garden|6 letters: Advanced level +flower|6 letters: Advanced level +butterfly|9 letters: Master level +insect|6 letters: Advanced level +spider|6 letters: Advanced level +honey|5 letters: Intermediate level +bread|5 letters: Intermediate level +cheese|6 letters: Advanced level +butter|6 letters: Advanced level +sugar|5 letters: Intermediate level +salt|4-5 letters: Intermediate level +water|5 letters: Intermediate level +juice|5 letters: Intermediate level +breakfast|9 letters: Master level +lunch|5 letters: Intermediate level +dinner|6 letters: Advanced level +family|6 letters: Advanced level +parent|6 letters: Advanced level +child|5 letters: Intermediate level +baby|4-5 letters: Intermediate level +friendship|10 letters: Guru level +team|4-5 letters: Intermediate level +game|4-5 letters: Intermediate level +score|5 letters: Intermediate level +win|2-3 letters: Basic level +lose|4-5 letters: Intermediate level +practice|8 letters: Master level +try|2-3 letters: Basic level +build|5 letters: Intermediate level +fix|2-3 letters: Basic level +carry|5 letters: Intermediate level +push|4-5 letters: Intermediate level +pull|4-5 letters: Intermediate level +climb|5 letters: Intermediate level +slide|5 letters: Intermediate level +swing|5 letters: Intermediate level +throw|5 letters: Intermediate level +catch|5 letters: Intermediate level +balance|7 letters: Advanced level +careful|7 letters: Advanced level +safe|4-5 letters: Intermediate level +brave|5 letters: Intermediate level +about|5 letters: Intermediate level +above|5 letters: Intermediate level +across|6 letters: Advanced level +answer|6 letters: Advanced level +around|6 letters: Advanced level +behind|6 letters: Advanced level +between|7 letters: Advanced level +busy|4-5 letters: Intermediate level +change|6 letters: Advanced level +children|8 letters: Master level +complete|8 letters: Master level +correct|7 letters: Advanced level +decide|6 letters: Advanced level +different|9 letters: Master level +during|6 letters: Advanced level +early|5 letters: Intermediate level +example|7 letters: Advanced level +excited|7 letters: Advanced level +explain|7 letters: Advanced level +follow|6 letters: Advanced level +forward|7 letters: Advanced level +important|9 letters: Master level +inside|6 letters: Advanced level +instead|7 letters: Advanced level +learn|5 letters: Intermediate level +listen|6 letters: Advanced level +maybe|5 letters: Intermediate level +minute|6 letters: Advanced level +morning|7 letters: Advanced level +natural|7 letters: Advanced level +notice|6 letters: Advanced level +often|5 letters: Intermediate level +outside|7 letters: Advanced level +pattern|7 letters: Advanced level +person|6 letters: Advanced level +picture|7 letters: Advanced level +problem|7 letters: Advanced level +question|8 letters: Master level +remember|8 letters: Master level +sentence|8 letters: Master level +separate|8 letters: Master level +simple|6 letters: Advanced level +special|7 letters: Advanced level +suddenly|8 letters: Master level +surface|7 letters: Advanced level +system|6 letters: Advanced level +together|8 letters: Master level +toward|6 letters: Advanced level +understand|10 letters: Guru level +usually|7 letters: Advanced level +weather|7 letters: Advanced level +whole|5 letters: Intermediate level +without|7 letters: Advanced level +almost|6 letters: Advanced level +better|6 letters: Advanced level +caught|6 letters: Advanced level +choose|6 letters: Advanced level +clothes|7 letters: Advanced level +cover|5 letters: Intermediate level +discover|8 letters: Master level +engine|6 letters: Advanced level +favorite|8 letters: Master level +field|5 letters: Intermediate level +future|6 letters: Advanced level +happen|6 letters: Advanced level +island|6 letters: Advanced level +journey|7 letters: Advanced level +machine|7 letters: Advanced level +matter|6 letters: Advanced level +moment|6 letters: Advanced level +music|5 letters: Intermediate level +planet|6 letters: Advanced level +present|7 letters: Advanced level +quickly|7 letters: Advanced level +reason|6 letters: Advanced level +result|6 letters: Advanced level +shadow|6 letters: Advanced level +signal|6 letters: Advanced level +travel|6 letters: Advanced level +village|7 letters: Advanced level +activity|8 letters: Master level +adventure|9 letters: Master level +agree|5 letters: Intermediate level +ancient|7 letters: Advanced level +appear|6 letters: Advanced level +arrange|7 letters: Advanced level +attention|9 letters: Master level +behavior|8 letters: Master level +belief|6 letters: Advanced level +breathe|7 letters: Advanced level +calendar|8 letters: Master level +category|8 letters: Master level +celebrate|9 letters: Master level +compare|7 letters: Advanced level +condition|9 letters: Master level +consider|8 letters: Master level +continue|8 letters: Master level +describe|8 letters: Master level +develop|7 letters: Advanced level +distance|8 letters: Master level +effect|6 letters: Advanced level +energy|6 letters: Advanced level +environment|11 letters: Guru level +equipment|9 letters: Master level +escape|6 letters: Advanced level +exercise|8 letters: Master level +experiment|10 letters: Guru level +familiar|8 letters: Master level +feature|7 letters: Advanced level +freedom|7 letters: Advanced level +function|8 letters: Master level +government|10 letters: Guru level +history|7 letters: Advanced level +identify|8 letters: Master level +improve|7 letters: Advanced level +include|7 letters: Advanced level +increase|8 letters: Master level +independent|11 letters: Guru level +information|11 letters: Guru level +instruction|10 letters: Guru level +interest|8 letters: Master level +invent|6 letters: Advanced level +language|8 letters: Master level +material|8 letters: Master level +measure|7 letters: Advanced level +method|6 letters: Advanced level +modern|6 letters: Advanced level +observe|7 letters: Advanced level +opinion|7 letters: Advanced level +opposite|8 letters: Master level +ordinary|8 letters: Master level +organize|8 letters: Master level +original|8 letters: Master level +participate|11 letters: Guru level +perform|7 letters: Advanced level +persuade|8 letters: Master level +position|8 letters: Master level +predict|7 letters: Advanced level +prevent|7 letters: Advanced level +process|7 letters: Advanced level +protect|7 letters: Advanced level +purpose|7 letters: Advanced level +recognize|9 letters: Master level +reduce|6 letters: Advanced level +reflect|7 letters: Advanced level +region|6 letters: Advanced level +regular|7 letters: Advanced level +require|7 letters: Advanced level +resource|8 letters: Master level +respond|7 letters: Advanced level +responsible|11 letters: Guru level +schedule|8 letters: Master level +section|7 letters: Advanced level +select|6 letters: Advanced level +similar|7 letters: Advanced level +solution|8 letters: Master level +strategy|8 letters: Master level +structure|9 letters: Master level +suggest|7 letters: Advanced level +support|7 letters: Advanced level +symbol|6 letters: Advanced level +temperature|11 letters: Guru level +tradition|9 letters: Master level +transport|9 letters: Master level +variety|7 letters: Advanced level` }; // ========== NEURAL INITIALIZATION ========== document.addEventListener('DOMContentLoaded', async function() { + // Initialize sound manager + soundManager.init(); + // Initialize neural network visualization initNeuralVisualization(); @@ -1825,17 +3466,16 @@ // Initialize event neural pathways initEventNeuralPathways(); - // Load initial lexical unit - loadLexicalUnit(); + // Load initial word + loadWord(); // Update neural interface updateNeuralInterface(); updateQuickStats(); - renderNeuralBadges(); - renderNeuralHistory(); + updateSidebarStats(); // Display neural welcome - showNeuralToast('Neural System Online', 'Google TTS Engine primed. Neural training protocol initialized.', 'success'); + showToast('System Online', 'Training session initialized. Ready to learn!', 'success'); // Initialize temporal tracking NeuralState.startTime = Date.now(); @@ -1876,194 +3516,264 @@ // ========== LEXICAL DATABASE LOADER ========== async function loadWordLists() { - const fileMapping = { - grade1: 'grade1.txt', grade2: 'grade2.txt', grade3: 'grade3.txt', - grade4: 'grade4.txt', grade5: 'grade5.txt', grade6: 'grade6.txt', - sentence1: 'sent1.txt', sentence2: 'sentence2.txt', - sentence3: 'sentence3.txt', time: 'time.txt', trini: 'trini.txt' - }; - - // Comprehensive fallback lexical database - const comprehensiveDatabase = { - grade1: [ - { word: "CAT", context: "The small feline pet." }, - { word: "DOG", context: "A loyal canine companion." }, - { word: "SUN", context: "The star that provides daylight." }, - { word: "MOON", context: "Earth's natural satellite." }, - { word: "STAR", context: "A distant celestial body." }, - { word: "BOOK", context: "A collection of written pages." }, - { word: "TREE", context: "A tall perennial plant." }, - { word: "FISH", context: "An aquatic vertebrate animal." }, - { word: "BIRD", context: "A feathered flying creature." }, - { word: "CAKE", context: "A sweet baked dessert." }, - { word: "RAIN", context: "Water falling from clouds." }, - { word: "SNOW", context: "Frozen precipitation in flakes." }, - { word: "FIRE", context: "Combustion producing heat and light." }, - { word: "WIND", context: "Moving air in the atmosphere." }, - { word: "SEA", context: "A large body of salt water." } - ], - grade2: [ - { word: "APPLE", context: "A round fruit with red or green skin." }, - { word: "CHAIR", context: "Furniture for sitting." }, - { word: "HOUSE", context: "A building for human habitation." }, - { word: "TABLE", context: "Furniture with a flat surface." }, - { word: "WATER", context: "A clear liquid essential for life." }, - { word: "GRASS", context: "Short green plants covering ground." }, - { word: "CLOUD", context: "A visible mass of water droplets." }, - { word: "FLOWER", context: "The colorful part of a plant." }, - { word: "PENCIL", context: "A writing instrument with graphite." }, - { word: "SCHOOL", context: "An institution for education." }, - { word: "MOTHER", context: "A female parent." }, - { word: "FATHER", context: "A male parent." }, - { word: "SISTER", context: "A female sibling." }, - { word: "BROTHER", context: "A male sibling." }, - { word: "FAMILY", context: "A group of related individuals." } - ], - grade3: [ - { word: "BUTTERFLY", context: "An insect with colorful wings." }, - { word: "ELEPHANT", context: "A large mammal with a trunk." }, - { word: "MOUNTAIN", context: "A large natural elevation." }, - { word: "HOSPITAL", context: "A place for medical treatment." }, - { word: "BIRTHDAY", context: "The anniversary of one's birth." }, - { word: "CHILDREN", context: "Young human beings." }, - { word: "BREAKFAST", context: "The first meal of the day." }, - { word: "PICTURE", context: "A visual representation." }, - { word: "MORNING", context: "The early part of the day." }, - { word: "WEATHER", context: "The state of the atmosphere." }, - { word: "LIBRARY", context: "A collection of books." }, - { word: "GARDEN", context: "A piece of ground for plants." }, - { word: "OCEAN", context: "A very large expanse of sea." }, - { word: "ANIMAL", context: "A living organism that feeds." }, - { word: "COUNTRY", context: "A nation with its own government." } - ], - grade4: [ - { word: "RESPONSIBILITY", context: "The state of being accountable." }, - { word: "COMMUNICATION", context: "The imparting of information." }, - { word: "EXPERIMENT", context: "A scientific procedure." }, - { word: "TEMPERATURE", context: "The degree of heat present." }, - { word: "CELEBRATION", context: "The action of marking an event." }, - { word: "EDUCATION", context: "The process of receiving instruction." }, - { word: "INFORMATION", context: "Facts provided about something." }, - { word: "EXPLORATION", context: "The action of traveling." }, - { word: "CONVERSATION", context: "A talk between two or more people." }, - { word: "IMAGINATION", context: "The ability to form mental images." } - ], - grade5: [ - { word: "PHOTOGRAPH", context: "A picture made using a camera." }, - { word: "ASTONISHING", context: "Extremely surprising." }, - { word: "BENEATH", context: "Extending underneath." }, - { word: "CAPITAL", context: "The most important city." }, - { word: "DECISION", context: "A conclusion after consideration." }, - { word: "EVIDENCE", context: "The available body of facts." }, - { word: "FREQUENT", context: "Occurring often." }, - { word: "GENERATION", context: "All people born at a similar time." }, - { word: "HABITAT", context: "The natural home of an organism." }, - { word: "IDENTICAL", context: "Similar in every detail." } - ], - grade6: [ - { word: "ACCOMPLISHMENT", context: "Something achieved successfully." }, - { word: "BIBLIOGRAPHY", context: "A list of source materials." }, - { word: "CONSEQUENCE", context: "A result or effect of an action." }, - { word: "DETERMINATION", context: "Firmness of purpose." }, - { word: "ENVIRONMENT", context: "The surroundings or conditions." }, - { word: "FUNDAMENTAL", context: "Forming a necessary base." }, - { word: "GOVERNMENT", context: "The governing body of a nation." }, - { word: "HYPOTHESIS", context: "A proposed explanation." }, - { word: "INVESTIGATION", context: "Formal inquiry or examination." }, - { word: "JUSTIFICATION", context: "The action of showing something to be right." } - ] - }; - - // Load comprehensive database - for (const grade in comprehensiveDatabase) { - NeuralState.wordLists[grade] = comprehensiveDatabase[grade]; - } - - // Set initial lexical database - NeuralState.currentWordList = NeuralState.wordLists.grade1; + // Parse all files from fileSystem + for (const filePath in fileSystem) { + const fileName = filePath.split('/').pop().replace('.txt', ''); + const content = fileSystem[filePath]; + const lines = content.split('\n'); + const wordList = []; + + for (const line of lines) { + if (line.trim()) { + const parts = line.split('|'); + if (parts.length >= 2) { + wordList.push({ + word: parts[0].trim().toUpperCase(), + context: parts[1].trim(), + definition: parts.length >= 3 ? parts[2].trim() : '' + }); + } + } + } + + NeuralState.wordLists[fileName] = wordList; + } + + console.log('Loaded word lists:', Object.keys(NeuralState.wordLists)); } - // ========== NEURAL TRAINING SESSION ========== + // ========== TRAINING SESSION INITIALIZATION ========== function initTrainingSession() { - const mode = document.getElementById('trainingMode').value; - const difficulty = document.getElementById('difficultyLevel').value; + NeuralState.trainingMode = document.getElementById('trainingMode').value; + NeuralState.difficultyLevel = document.getElementById('difficultyLevel').value; + NeuralState.sessionLength = parseInt(document.getElementById('sessionSlider').value); + NeuralState.totalWords = NeuralState.sessionLength; - // Select appropriate lexical database - let wordListKey = difficulty; - if (mode === 'sentence') wordListKey = 'sentence1'; - else if (mode === 'time') wordListKey = 'time'; - else if (mode === 'trini') wordListKey = 'trini'; + // Update UI + document.getElementById('sessionLengthValue').textContent = `${NeuralState.sessionLength} words`; + + // Handle Trini Mode + NeuralState.triniMode = NeuralState.trainingMode === 'trini'; + const triniOverlay = document.getElementById('triniOverlay'); + if (NeuralState.triniMode) { + triniOverlay.classList.add('active'); + document.getElementById('mainTitle').style.background = 'linear-gradient(135deg, var(--trini-red), var(--trini-green), var(--trini-black))'; + document.getElementById('mainSubtitle').style.color = var('--trini-white'); + } else { + triniOverlay.classList.remove('active'); + document.getElementById('mainTitle').style.background = 'linear-gradient(135deg, var(--neural-primary), var(--neural-secondary), var(--neural-accent))'; + document.getElementById('mainSubtitle').style.color = var('--neural-muted'); + } + + // Select word list based on training mode + let wordListKey = NeuralState.difficultyLevel; + + if (NeuralState.trainingMode === 'sentence') { + wordListKey = NeuralState.difficultyLevel.replace('grade', 'sentence'); + } else if (NeuralState.trainingMode === 'time') { + wordListKey = 'time'; + } else if (NeuralState.trainingMode === 'trini') { + wordListKey = 'trini'; + } else if (NeuralState.trainingMode === 'adaptive') { + wordListKey = 'adaptive'; + NeuralState.adaptiveLevel = 'basic'; + } NeuralState.currentWordList = NeuralState.wordLists[wordListKey] || NeuralState.wordLists.grade1; - // Set session duration - NeuralState.totalWords = parseInt(document.getElementById('sessionLength').value); - if (isNaN(NeuralState.totalWords) || NeuralState.totalWords > NeuralState.currentWordList.length) { - NeuralState.totalWords = Math.min(15, NeuralState.currentWordList.length); + // Handle different training modes + if (NeuralState.trainingMode === 'random') { + // Shuffle all words from all grades except sentences + const allWords = []; + for (const key in NeuralState.wordLists) { + if (!key.includes('sentence') && key !== 'time' && key !== 'trini' && key !== 'adaptive') { + allWords.push(...NeuralState.wordLists[key]); + } + } + NeuralState.shuffledWordList = shuffleArray([...allWords]); + NeuralState.currentWordList = NeuralState.shuffledWordList.slice(0, NeuralState.totalWords); + } else if (NeuralState.trainingMode === 'sequential') { + // Use selected difficulty level + NeuralState.currentWordList = NeuralState.wordLists[wordListKey] || NeuralState.wordLists.grade1; + } else if (NeuralState.trainingMode === 'adaptive') { + // Start with basic level words + NeuralState.currentWordList = filterAdaptiveWords('basic'); } - // Reset neural training state + // Reset session state NeuralState.currentWordIndex = 0; NeuralState.score = 0; NeuralState.streak = 0; NeuralState.sessionTime = 0; NeuralState.performance.currentStreak = 0; NeuralState.sessionHistory = []; + NeuralState.recentWords = []; - // Randomize if in practice mode - if (mode === 'practice') { - shuffleNeuralArray(NeuralState.currentWordList); + // Hide/show context button based on mode + const contextBtn = document.getElementById('contextBtn'); + if (NeuralState.trainingMode === 'sentence' || + NeuralState.difficultyLevel.includes('sentence')) { + contextBtn.style.display = 'none'; + } else { + contextBtn.style.display = 'flex'; } - // Update neural interface + // Update UI updateNeuralInterface(); } - // ========== LEXICAL UNIT PROCESSOR ========== - function loadLexicalUnit() { - if (NeuralState.currentWordIndex >= NeuralState.currentWordList.length) { - showNeuralCompletionModal(); + // ========== ADAPTIVE MODE FUNCTIONS ========== + function filterAdaptiveWords(level) { + const allWords = NeuralState.wordLists.adaptive || []; + return allWords.filter(word => { + const context = word.context || ''; + return context.toLowerCase().includes(level.toLowerCase()); + }); + } + + function updateAdaptiveLevel() { + const currentLevel = NeuralState.adaptiveLevel; + const progress = NeuralState.adaptiveProgress[currentLevel]; + + if (progress.total >= 5) { + const successRate = progress.correct / progress.total; + const threshold = NeuralState.adaptiveLevelThresholds[currentLevel] / 10; + + if (successRate >= threshold) { + // Level up + const currentIndex = NeuralState.adaptiveLevels.indexOf(currentLevel); + if (currentIndex < NeuralState.adaptiveLevels.length - 1) { + NeuralState.adaptiveLevel = NeuralState.adaptiveLevels[currentIndex + 1]; + showToast('Level Up!', `Advanced to ${NeuralState.adaptiveLevel} level`, 'success'); + } + } else if (successRate < 0.3 && currentIndex > 0) { + // Level down + const currentIndex = NeuralState.adaptiveLevels.indexOf(currentLevel); + NeuralState.adaptiveLevel = NeuralState.adaptiveLevels[currentIndex - 1]; + showToast('Level Adjusted', `Moved to ${NeuralState.adaptiveLevel} level`, 'warning'); + } + + // Reset progress for current level + NeuralState.adaptiveProgress[currentLevel] = { correct: 0, total: 0 }; + } + + // Update word list for new level + NeuralState.currentWordList = filterAdaptiveWords(NeuralState.adaptiveLevel); + } + + // ========== WORD LOADING ========== + function loadWord() { + if (NeuralState.currentWordIndex >= NeuralState.totalWords) { + completeSession(); return; } - const lexicalData = NeuralState.currentWordList[NeuralState.currentWordIndex]; - NeuralState.currentWord = lexicalData.word.toUpperCase(); - NeuralState.currentContext = lexicalData.context; - NeuralState.maskedWord = maskLexicalUnit(NeuralState.currentWord, 0); + // Stop any ongoing timer + if (NeuralState.wordTimer) { + clearTimeout(NeuralState.wordTimer); + NeuralState.wordTimer = null; + } + + // Get word data + let wordData; + if (NeuralState.trainingMode === 'adaptive' && NeuralState.currentWordList.length === 0) { + // Refresh adaptive word list if empty + NeuralState.currentWordList = filterAdaptiveWords(NeuralState.adaptiveLevel); + } + + if (NeuralState.currentWordIndex < NeuralState.currentWordList.length) { + wordData = NeuralState.currentWordList[NeuralState.currentWordIndex]; + } else { + // Fallback if word list is shorter than session length + wordData = { + word: "EXAMPLE", + context: "This is an example word.", + definition: "A representative form or pattern." + }; + } + + NeuralState.currentWord = wordData.word.toUpperCase(); + NeuralState.currentContext = wordData.context || ""; + NeuralState.currentDefinition = wordData.definition || ""; + NeuralState.maskedWord = maskWord(NeuralState.currentWord, 0); NeuralState.revealedLetters = 0; NeuralState.isCorrect = false; NeuralState.isFirstTry = true; NeuralState.attempts = 0; NeuralState.hintsUsed = 0; + NeuralState.contextClickCount = 0; + NeuralState.wordStartTime = Date.now(); + NeuralState.wordTime = 0; - // Update neural display (NO VISIBLE WORD) + // Update display (NO VISIBLE WORD) document.getElementById('currentWord').textContent = NeuralState.maskedWord; - document.getElementById('wordContext').textContent = NeuralState.currentContext || "Neural context unavailable."; + document.getElementById('wordContext').textContent = "Listen to the word and spell it correctly."; document.getElementById('wordDisplay').className = 'word-display-container'; - document.getElementById('feedbackContainer').className = 'feedback-container'; + document.getElementById('feedbackContainer').className = 'feedbackContainer'; document.getElementById('answerInput').value = ''; document.getElementById('nextWordBtn').disabled = true; - // Auto-initialize audio if enabled - if (document.getElementById('autoPlayCheck')?.checked) { - setTimeout(() => speakLexicalUnit(), 600); + // Reset button states + document.getElementById('hintBtn').disabled = !NeuralState.settings.hintsEnabled; + document.getElementById('revealBtn').disabled = false; + document.getElementById('spellOutBtn').disabled = !NeuralState.settings.spellOutEnabled; + + // Auto-play audio if enabled + if (NeuralState.settings.autoPlay) { + setTimeout(() => speakWord(), 500); } - // Update neural progress - updateNeuralProgress(); + // Start timer for timed mode + if (NeuralState.trainingMode === 'timed') { + startWordTimer(); + } + + // Update progress + updateNeuralInterface(); + updateSidebarStats(); + } + + // ========== TIMED MODE FUNCTIONS ========== + function startWordTimer() { + NeuralState.wordTime = 0; + NeuralState.wordTimer = setInterval(() => { + NeuralState.wordTime++; + if (NeuralState.wordTime >= NeuralState.timePerWord) { + clearInterval(NeuralState.wordTimer); + timeUp(); + } + }, 1000); + } + + function timeUp() { + if (!NeuralState.isCorrect) { + showFeedback('⏰ Time\'s up! The word was not spelled in time.', 'incorrect'); + document.getElementById('wordDisplay').classList.add('incorrect'); + document.getElementById('nextWordBtn').disabled = false; + NeuralState.performance.incorrect++; + NeuralState.streak = 0; + NeuralState.performance.currentStreak = 0; + } } - // ========== GOOGLE TTS ENGINE (PRIMARY) ========== - async function speakLexicalUnit() { + // ========== TTS ENGINE ========== + async function speakWord() { + if (NeuralState.isSpeaking) return; + try { + NeuralState.isSpeaking = true; + if (NeuralState.ttsEngine === 'google' && NeuralState.googleApiKey) { await speakWithGoogleTTS(NeuralState.currentWord); } else { await speakWithEdgeTTS(NeuralState.currentWord); } } catch (error) { - console.error('Primary TTS failed, using fallback:', error); - await speakWithEdgeTTS(NeuralState.currentWord); + console.error('TTS failed:', error); + // Fallback to Web Speech API + speakWithWebSpeech(NeuralState.currentWord); + } finally { + NeuralState.isSpeaking = false; } } @@ -2072,125 +3782,117 @@ throw new Error('Google TTS not configured'); } - try { - const response = await fetch( - `https://texttospeech.googleapis.com/v1/text:synthesize?key=${NeuralState.googleApiKey}`, - { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ - input: { text: text }, - voice: { - languageCode: 'en-US', - name: NeuralState.googleVoice - }, - audioConfig: { - audioEncoding: 'MP3', - speakingRate: NeuralState.speechRate, - pitch: NeuralState.speechPitch - } - }) - } - ); - - if (!response.ok) { - const errorData = await response.json(); - throw new Error(`Google TTS API error: ${JSON.stringify(errorData)}`); + const response = await fetch( + `https://texttospeech.googleapis.com/v1/text:synthesize?key=${NeuralState.googleApiKey}`, + { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + input: { text: text }, + voice: { + languageCode: 'en-US', + name: NeuralState.googleVoice + }, + audioConfig: { + audioEncoding: 'MP3', + speakingRate: NeuralState.speechRate, + pitch: NeuralState.speechPitch + } + }) } - - const data = await response.json(); - const audio = new Audio('data:audio/mp3;base64,' + data.audioContent); - audio.volume = NeuralState.speechVolume; - - NeuralState.isSpeaking = true; + ); + + if (!response.ok) throw new Error('Google TTS API error'); + + const data = await response.json(); + const audio = new Audio('data:audio/mp3;base64,' + data.audioContent); + audio.volume = NeuralState.speechVolume; + + return new Promise((resolve) => { audio.play(); - - return new Promise((resolve) => { - audio.onended = () => { - NeuralState.isSpeaking = false; - resolve(); - }; - audio.onerror = () => { - NeuralState.isSpeaking = false; - resolve(); - }; - }); - } catch (error) { - console.error('Google TTS failed:', error); - throw error; - } + audio.onended = resolve; + audio.onerror = resolve; + }); } - // ========== EDGE TTS ENGINE (FALLBACK) ========== async function speakWithEdgeTTS(text) { return new Promise((resolve) => { - try { - const encodedText = encodeURIComponent(text); - const voice = NeuralState.edgeVoice; - const rate = Math.round(NeuralState.speechRate * 100); - const url = `https://edge.microsoft.com/tts/v1/speak?text=${encodedText}&voice=${voice}&rate=${rate}%`; - - const audio = new Audio(url); - audio.volume = NeuralState.speechVolume; - - NeuralState.isSpeaking = true; - audio.play(); - - audio.onended = () => { - NeuralState.isSpeaking = false; - resolve(); - }; - - audio.onerror = () => { - NeuralState.isSpeaking = false; - resolve(); - }; - } catch (error) { - console.error('Edge TTS failed:', error); - NeuralState.isSpeaking = false; - resolve(); - } + const encodedText = encodeURIComponent(text); + const voice = NeuralState.edgeVoice; + const rate = Math.round(NeuralState.speechRate * 100); + const url = `https://edge.microsoft.com/tts/v1/speak?text=${encodedText}&voice=${voice}&rate=${rate}%`; + + const audio = new Audio(url); + audio.volume = NeuralState.speechVolume; + audio.play(); + + audio.onended = resolve; + audio.onerror = resolve; }); } - // ========== LEXICAL UNIT VALIDATION ========== - function validateLexicalSequence() { + function speakWithWebSpeech(text) { + if ('speechSynthesis' in window) { + const utterance = new SpeechSynthesisUtterance(text); + utterance.rate = NeuralState.speechRate; + utterance.pitch = NeuralState.speechPitch; + utterance.volume = NeuralState.speechVolume; + speechSynthesis.speak(utterance); + } + } + + // ========== ANSWER VALIDATION ========== + function validateAnswer() { const input = document.getElementById('answerInput'); - const userSequence = input.value.trim().toUpperCase(); + const userAnswer = input.value.trim().toUpperCase(); - if (!userSequence) { - showNeuralToast('Empty Sequence', 'Please input phonetic sequence.', 'warning'); + if (!userAnswer) { + showToast('Empty Input', 'Please type the word', 'warning'); + return; + } + + // Prevent multiple submissions for same word + if (NeuralState.isCorrect) { + showToast('Already Correct', 'Word already spelled correctly', 'info'); return; } NeuralState.attempts++; - if (userSequence === NeuralState.currentWord) { - processCorrectSequence(); + if (userAnswer === NeuralState.currentWord) { + handleCorrectAnswer(); } else { - processIncorrectSequence(); + handleIncorrectAnswer(); } } - function processCorrectSequence() { + function handleCorrectAnswer() { NeuralState.isCorrect = true; + NeuralState.wordTime = Math.floor((Date.now() - NeuralState.wordStartTime) / 1000); NeuralState.isFirstTry = NeuralState.attempts === 1 && NeuralState.hintsUsed === 0; - // Calculate neural points - let neuralPoints = 0; + // Calculate score + let points = 0; if (NeuralState.isFirstTry) { - neuralPoints = 10; + points = 10; NeuralState.streak++; NeuralState.performance.currentStreak++; - showNeuralFeedback('🧠 PERFECT NEURAL MATCH! +10 points', 'correct'); + soundManager.play('perfect'); + showFeedback('🎉 Perfect! +10 points', 'correct'); + + // Visual effects for perfect answer + if (NeuralState.settings.animations) { + VisualEffects.createFireworks(window.innerWidth / 2, window.innerHeight / 2); + } } else { - neuralPoints = 5; + points = 5; NeuralState.streak = 0; - showNeuralFeedback('✅ CORRECT SEQUENCE! +5 points', 'correct'); + soundManager.play('correct'); + showFeedback('✅ Correct! +5 points', 'correct'); } - // Update neural score - NeuralState.score += neuralPoints; + // Update score + NeuralState.score += points; // Update performance metrics NeuralState.performance.totalWordsCompleted++; @@ -2205,37 +3907,60 @@ NeuralState.performance.longestStreak = NeuralState.performance.currentStreak; } - // Add to neural history + // Update best streak today + if (NeuralState.performance.currentStreak > NeuralState.performance.bestStreakToday) { + NeuralState.performance.bestStreakToday = NeuralState.performance.currentStreak; + } + + // Update fastest word + if (!NeuralState.performance.fastestWord || NeuralState.wordTime < NeuralState.performance.fastestWord.time) { + NeuralState.performance.fastestWord = { + word: NeuralState.currentWord, + time: NeuralState.wordTime + }; + } + + // Add to history const historyEntry = { word: NeuralState.currentWord, status: NeuralState.isFirstTry ? 'perfect' : 'hint', attempts: NeuralState.attempts, hints: NeuralState.hintsUsed, - time: Math.floor((Date.now() - NeuralState.startTime) / 1000), + time: NeuralState.wordTime, timestamp: Date.now(), - points: neuralPoints + points: points }; NeuralState.history.unshift(historyEntry); NeuralState.sessionHistory.push(historyEntry); + NeuralState.recentWords.unshift(NeuralState.currentWord); + if (NeuralState.recentWords.length > 5) { + NeuralState.recentWords = NeuralState.recentWords.slice(0, 5); + } - // Cache to neural memory + // Save to localStorage localStorage.setItem('wordHistory', JSON.stringify(NeuralState.history.slice(0, 100))); - // Enable next unit + // Enable next word button document.getElementById('nextWordBtn').disabled = false; - // Show masked sequence - document.getElementById('currentWord').textContent = NeuralState.currentWord; + // Update display to show word (still masked in display, but correct state) + document.getElementById('currentWord').textContent = maskWord(NeuralState.currentWord, NeuralState.currentWord.length); document.getElementById('wordDisplay').classList.add('correct'); - // Update neural interface + // Update adaptive mode progress + if (NeuralState.trainingMode === 'adaptive') { + const level = NeuralState.adaptiveLevel; + NeuralState.adaptiveProgress[level].total++; + if (NeuralState.isFirstTry) { + NeuralState.adaptiveProgress[level].correct++; + } + } + + // Update interface updateNeuralInterface(); updateQuickStats(); - renderNeuralHistory(); - - // Check for neural achievements - checkNeuralAchievements(); + updateSidebarStats(); // Auto-proceed after delay setTimeout(() => { @@ -2245,15 +3970,15 @@ }, 2000); } - function processIncorrectSequence() { + function handleIncorrectAnswer() { NeuralState.isFirstTry = false; NeuralState.streak = 0; NeuralState.performance.currentStreak = 0; - showNeuralFeedback('❌ INCORRECT SEQUENCE. Recalibrate neural pathways.', 'incorrect'); + soundManager.play('incorrect'); + showFeedback('❌ Incorrect. Try again.', 'incorrect'); document.getElementById('wordDisplay').classList.add('incorrect'); - // Update performance metrics NeuralState.performance.incorrect++; // Clear input for retry @@ -2263,80 +3988,332 @@ }, 1000); updateNeuralInterface(); + updateSidebarStats(); } - // ========== NEURAL ASSISTANCE FUNCTIONS ========== - function provideNeuralAssistance() { - if (NeuralState.revealedLetters >= NeuralState.currentWord.length) return; + // ========== HINT SYSTEM ========== + function provideHint() { + if (!NeuralState.settings.hintsEnabled || NeuralState.revealedLetters >= NeuralState.currentWord.length) { + return; + } NeuralState.revealedLetters++; NeuralState.hintsUsed++; // Update masked display - NeuralState.maskedWord = maskLexicalUnit(NeuralState.currentWord, NeuralState.revealedLetters); + NeuralState.maskedWord = maskWord(NeuralState.currentWord, NeuralState.revealedLetters); document.getElementById('currentWord').textContent = NeuralState.maskedWord; - // Update interface - updateNeuralInterface(); - - // Announce assistance + // Speak the revealed letter const revealedLetter = NeuralState.currentWord[NeuralState.revealedLetters - 1]; - speakWithGoogleTTS(`Neural assistance: Position ${NeuralState.revealedLetters} is ${revealedLetter}`); + speakWithGoogleTTS(`Hint: Position ${NeuralState.revealedLetters} is ${revealedLetter}`); + + updateNeuralInterface(); } - function revealLexicalSequence() { + function revealWord() { NeuralState.revealedLetters = NeuralState.currentWord.length; - NeuralState.maskedWord = maskLexicalUnit(NeuralState.currentWord, NeuralState.revealedLetters); + NeuralState.maskedWord = maskWord(NeuralState.currentWord, NeuralState.revealedLetters); document.getElementById('currentWord').textContent = NeuralState.maskedWord; document.getElementById('hintBtn').disabled = true; + document.getElementById('revealBtn').disabled = true; + + speakWithGoogleTTS(`The word is: ${NeuralState.currentWord}`); + showToast('Word Revealed', 'Study the word for next time', 'warning'); + } + + function spellOutWord() { + if (!NeuralState.settings.spellOutEnabled) return; + + const letters = NeuralState.currentWord.split(''); + let spelled = ''; + letters.forEach((letter, index) => { + spelled += letter; + if (index < letters.length - 1) spelled += '. '; + }); + spelled += '.'; + speakWithGoogleTTS(spelled); + } + + function handleContextClick() { + NeuralState.contextClickCount++; - speakWithGoogleTTS(`Sequence revealed: ${NeuralState.currentWord}`); - showNeuralToast('Sequence Revealed', 'Neural pathway activated. Commit to memory.', 'warning'); + if (NeuralState.contextClickCount % 2 === 1) { + // Odd click: speak sentence + if (NeuralState.currentContext) { + speakWithGoogleTTS(NeuralState.currentContext); + } + } else { + // Even click: speak definition + if (NeuralState.currentDefinition) { + speakWithGoogleTTS(NeuralState.currentDefinition); + } else { + speakWithGoogleTTS(`Definition not available for ${NeuralState.currentWord}`); + } + } } - // ========== NEURAL INTERFACE UPDATER ========== + // ========== UI UPDATES ========== function updateNeuralInterface() { - // Update progress visualization + // Update progress const progressPercent = (NeuralState.currentWordIndex / NeuralState.totalWords) * 100; document.getElementById('progressFill').style.width = `${progressPercent}%`; document.getElementById('progressText').textContent = - `Lexical Unit ${NeuralState.currentWordIndex + 1}/${NeuralState.totalWords}`; + `Word ${NeuralState.currentWordIndex + 1}/${NeuralState.totalWords}`; - // Update neural statistics + // Update stats document.getElementById('scoreValue').textContent = NeuralState.score; document.getElementById('streakValue').textContent = NeuralState.streak; - // Calculate neural precision + // Calculate accuracy const totalAttempts = NeuralState.performance.perfectFirstTries + NeuralState.performance.hintCorrect + NeuralState.performance.incorrect; - const precision = totalAttempts > 0 ? + const accuracy = totalAttempts > 0 ? Math.round(((NeuralState.performance.perfectFirstTries + NeuralState.performance.hintCorrect) / totalAttempts) * 100) : 0; - document.getElementById('accuracyValue').textContent = `${precision}%`; + document.getElementById('accuracyValue').textContent = `${accuracy}%`; - // Update temporal index + // Update time document.getElementById('timeValue').textContent = `${Math.floor(NeuralState.sessionTime)}s`; - // Update masked display if not correct - if (!NeuralState.isCorrect) { - document.getElementById('currentWord').textContent = NeuralState.maskedWord; - } + // Update streak visualization + VisualEffects.createStreakVisualization(Math.min(NeuralState.streak, 10)); + document.getElementById('currentStreakValue').textContent = NeuralState.streak; - // Update assistance controls - document.getElementById('contextBtn').disabled = !NeuralState.currentContext; + // Update button states document.getElementById('hintBtn').disabled = NeuralState.isCorrect || - NeuralState.revealedLetters >= NeuralState.currentWord.length; + NeuralState.revealedLetters >= NeuralState.currentWord.length || + !NeuralState.settings.hintsEnabled; + document.getElementById('revealBtn').disabled = NeuralState.isCorrect; + document.getElementById('spellOutBtn').disabled = !NeuralState.settings.spellOutEnabled; + document.getElementById('contextBtn').disabled = !NeuralState.currentContext && !NeuralState.currentDefinition; + } + + function updateSidebarStats() { + // Update recent words + const recentWordsEl = document.getElementById('recentWords'); + if (NeuralState.recentWords.length > 0) { + recentWordsEl.innerHTML = NeuralState.recentWords + .map(word => `
${'█'.repeat(word.length)}
`) + .join(''); + } else { + recentWordsEl.textContent = 'No words yet'; + } + + // Update best stats + const bestStatsEl = document.getElementById('bestStats'); + const fastest = NeuralState.performance.fastestWord ? + `${NeuralState.performance.fastestWord.time}s` : '0s'; + bestStatsEl.textContent = `Streak: ${NeuralState.performance.bestStreakToday} | Fastest: ${fastest}`; + + // Update rank display + document.getElementById('rankDisplay').textContent = NeuralState.userRank; + } + + function updateQuickStats() { + const container = document.getElementById('quickStats'); + if (!container) return; + + const accuracy = NeuralState.performance.totalWordsCompleted > 0 ? + Math.round((NeuralState.performance.perfectFirstTries / NeuralState.performance.totalWordsCompleted) * 100) : 0; + + container.innerHTML = ` +
+ Rank: + ${NeuralState.userRank} +
+
+ Total Words: + ${NeuralState.performance.totalWordsCompleted} +
+
+ Accuracy: + ${accuracy}% +
+
+ Best Streak: + ${NeuralState.performance.longestStreak} +
+ `; + } + + // ========== SESSION COMPLETION ========== + function completeSession() { + // Stop any timers + if (NeuralState.wordTimer) { + clearInterval(NeuralState.wordTimer); + } + + // Calculate final statistics + const perfectCount = NeuralState.sessionHistory.filter(item => item.status === 'perfect').length; + const accuracy = NeuralState.sessionHistory.length > 0 ? + Math.round((perfectCount / NeuralState.sessionHistory.length) * 100) : 0; + + // Determine rank based on performance + const newRank = calculateRank(accuracy, NeuralState.streak, NeuralState.score); + NeuralState.userRank = newRank; + localStorage.setItem('userRank', newRank); + + // Update performance metrics + NeuralState.performance.totalSessions++; + NeuralState.performance.totalTime += NeuralState.sessionTime; + + // Save to localStorage + localStorage.setItem('totalSessions', NeuralState.performance.totalSessions); + localStorage.setItem('totalWordsCompleted', NeuralState.performance.totalWordsCompleted); + localStorage.setItem('perfectFirstTries', NeuralState.performance.perfectFirstTries); + localStorage.setItem('hintCorrect', NeuralState.performance.hintCorrect); + localStorage.setItem('incorrect', NeuralState.performance.incorrect); + localStorage.setItem('totalTime', NeuralState.performance.totalTime); + localStorage.setItem('longestStreak', NeuralState.performance.longestStreak); + + // Show completion modal + showCompletionModal(accuracy, perfectCount); + + // Show certificate after a delay + setTimeout(() => { + showCertificate(accuracy, perfectCount); + }, 3000); + } + + function calculateRank(accuracy, streak, score) { + if (accuracy >= 90 && streak >= 10) return 'GRAND MASTER'; + if (accuracy >= 80 && streak >= 8) return 'MASTER'; + if (accuracy >= 70 && streak >= 6) return 'EXPERT'; + if (accuracy >= 60 && streak >= 4) return 'ADVANCED'; + if (accuracy >= 50 && streak >= 2) return 'INTERMEDIATE'; + return 'BEGINNER'; + } + + function showCompletionModal(accuracy, perfectCount) { + const modal = document.getElementById('sessionCompleteModal'); + const content = document.getElementById('modalContent'); + + content.innerHTML = ` +
+
🏆
+

SESSION COMPLETE!

+

+ Great job! You've completed ${NeuralState.totalWords} words in ${Math.floor(NeuralState.sessionTime)} seconds. +

+ +
+
+
${NeuralState.score}
+
SCORE
+
+
+
${accuracy}%
+
ACCURACY
+
+
+
${perfectCount}
+
PERFECT
+
+
+
${NeuralState.userRank}
+
NEW RANK
+
+
+ +
+ + + +
+
+ `; + + modal.classList.add('active'); + + // Add event listeners for modal buttons + document.getElementById('newSessionModalBtn').addEventListener('click', () => { + modal.classList.remove('active'); + initTrainingSession(); + loadWord(); + NeuralState.startTime = Date.now(); + NeuralState.sessionTime = 0; + }); + + document.getElementById('viewCertificateBtn').addEventListener('click', () => { + modal.classList.remove('active'); + showCertificate(accuracy, perfectCount); + }); + } + + function showCertificate(accuracy, perfectCount) { + const modal = document.getElementById('certificateModal'); + const content = document.getElementById('certificateContent'); + + content.innerHTML = ` +
+
CERTIFICATE OF ACHIEVEMENT
+
Awarded to ${NeuralState.userName}
+ +
+
+ ${NeuralState.userRank} +
+
+ Spelling Training Session +
+
+ Completed on ${new Date().toLocaleDateString()} +
+
+ +
+
+
${NeuralState.totalWords}
+
Words
+
+
+
${accuracy}%
+
Accuracy
+
+
+
${perfectCount}
+
Perfect
+
+
+ +
+ + +
+
+ `; + + modal.classList.add('active'); + + document.getElementById('printCertificateBtn').addEventListener('click', () => { + window.print(); + }); + + document.getElementById('closeCertificateBtn').addEventListener('click', () => { + modal.classList.remove('active'); + }); } - // ========== NEURAL UTILITIES ========== - function maskLexicalUnit(word, revealed) { + // ========== UTILITY FUNCTIONS ========== + function maskWord(word, revealed) { return word.split('').map((char, index) => { if (char === ' ') return ' '; - return index < revealed ? char : '_'; + return index < revealed ? char : '█'; }).join(' '); } - function shuffleNeuralArray(array) { + function shuffleArray(array) { for (let i = array.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [array[i], array[j]] = [array[j], array[i]]; @@ -2344,16 +4321,62 @@ return array; } - // ========== NEURAL UI INITIALIZATION ========== + function showToast(title, message, type = 'info') { + const toastContainer = document.getElementById('toastContainer'); + const toastId = 'toast-' + Date.now(); + + const iconMap = { + success: '✅', + warning: 'âš ī¸', + error: '❌', + info: 'â„šī¸' + }; + + const toast = document.createElement('div'); + toast.className = `neural-toast ${type}`; + toast.id = toastId; + toast.innerHTML = ` +
${iconMap[type] || iconMap.info}
+
+
${title}
+
${message}
+
+ + `; + + toastContainer.appendChild(toast); + + setTimeout(() => { + const toastElement = document.getElementById(toastId); + if (toastElement) { + toastElement.style.opacity = '0'; + toastElement.style.transform = 'translateX(100%)'; + setTimeout(() => toastElement.remove(), 300); + } + }, 5000); + } + + function showFeedback(message, type) { + const feedback = document.getElementById('feedbackContainer'); + feedback.textContent = message; + feedback.className = `feedback-container ${type}`; + + setTimeout(() => { + feedback.className = 'feedback-container'; + }, 3000); + } + + // ========== UI INITIALIZATION ========== function initNeuralUI() { // Set user configuration document.getElementById('userName').value = NeuralState.userName; - document.getElementById('userLevel').value = NeuralState.userLevel; document.getElementById('googleApiKey').value = NeuralState.googleApiKey; document.getElementById('googleVoice').value = NeuralState.googleVoice; document.getElementById('ttsEngine').value = NeuralState.ttsEngine; - // Initialize control sliders + // Set sliders + document.getElementById('sessionSlider').value = NeuralState.sessionLength; + document.getElementById('sessionLengthValue').textContent = `${NeuralState.sessionLength} words`; document.getElementById('speechRate').value = NeuralState.speechRate; document.getElementById('speechPitch').value = NeuralState.speechPitch; document.getElementById('masterVolume').value = NeuralState.speechVolume; @@ -2362,64 +4385,62 @@ document.getElementById('rateValue').textContent = `${NeuralState.speechRate.toFixed(1)}x`; document.getElementById('pitchValue').textContent = NeuralState.speechPitch.toFixed(1); document.getElementById('volumeValue').textContent = `${Math.round(NeuralState.speechVolume * 100)}%`; + + // Set checkboxes from settings + document.getElementById('autoPlayCheck').checked = NeuralState.settings.autoPlay; + document.getElementById('soundEffectsCheck').checked = NeuralState.settings.soundEffects; + document.getElementById('animationsCheck').checked = NeuralState.settings.animations; + document.getElementById('hintsEnabledCheck').checked = NeuralState.settings.hintsEnabled; + document.getElementById('spellOutEnabledCheck').checked = NeuralState.settings.spellOutEnabled; + document.getElementById('difficultyAdjustment').value = NeuralState.settings.difficultyAdjustment; } - // ========== NEURAL EVENT PATHWAYS ========== + // ========== EVENT HANDLERS ========== function initEventNeuralPathways() { - // Tab neural pathways + // Tab switching document.querySelectorAll('.neural-tab').forEach(tab => { tab.addEventListener('click', function() { const panelId = this.getAttribute('data-tab'); - activateNeuralPanel(panelId); + activatePanel(panelId); }); }); - // Game control neural pathways - document.getElementById('hearWordBtn').addEventListener('click', () => speakLexicalUnit()); - document.getElementById('contextBtn').addEventListener('click', () => { - if (NeuralState.currentContext) { - speakWithGoogleTTS(NeuralState.currentContext); - } - }); - document.getElementById('spellOutBtn').addEventListener('click', () => { - const letters = NeuralState.currentWord.split(''); - let spelled = ''; - letters.forEach((letter, index) => { - spelled += letter; - if (index < letters.length - 1) spelled += '. '; - }); - spelled += '.'; - speakWithGoogleTTS(spelled); - }); + // Game controls + document.getElementById('hearWordBtn').addEventListener('click', () => speakWord()); + document.getElementById('contextBtn').addEventListener('click', () => handleContextClick()); + document.getElementById('spellOutBtn').addEventListener('click', () => spellOutWord()); document.getElementById('slowSpeechBtn').addEventListener('click', () => { - speakWithGoogleTTS(NeuralState.currentWord); + const oldRate = NeuralState.speechRate; + NeuralState.speechRate = 0.7; + speakWord().then(() => { + NeuralState.speechRate = oldRate; + }); }); - document.getElementById('repeatBtn').addEventListener('click', () => speakLexicalUnit()); + document.getElementById('repeatBtn').addEventListener('click', () => speakWord()); - // Validation neural pathway - document.getElementById('checkAnswerBtn').addEventListener('click', validateLexicalSequence); - document.getElementById('hintBtn').addEventListener('click', provideNeuralAssistance); + // Answer validation + document.getElementById('checkAnswerBtn').addEventListener('click', validateAnswer); + document.getElementById('hintBtn').addEventListener('click', provideHint); document.getElementById('nextWordBtn').addEventListener('click', () => { NeuralState.currentWordIndex++; - loadLexicalUnit(); + loadWord(); }); - document.getElementById('revealBtn').addEventListener('click', revealLexicalSequence); + document.getElementById('revealBtn').addEventListener('click', revealWord); - // Input neural pathway + // Input handling document.getElementById('answerInput').addEventListener('keypress', (e) => { if (e.key === 'Enter') { - validateLexicalSequence(); + validateAnswer(); } }); - // Google TTS configuration neural pathways + // Google TTS configuration document.getElementById('testGoogleBtn').addEventListener('click', async () => { const apiKey = document.getElementById('googleApiKey').value; const voice = document.getElementById('googleVoice').value; if (!apiKey) { - showNeuralToast('Configuration Required', - 'Enter Google Cloud API key for premium neural synthesis.', 'warning'); + showToast('API Key Required', 'Enter Google Cloud API key', 'warning'); return; } @@ -2429,102 +4450,136 @@ localStorage.setItem('googleVoice', voice); try { - await speakWithGoogleTTS("Google TTS neural synthesis online. System ready."); - showNeuralToast('Google TTS Online', 'Premium neural synthesis activated.', 'success'); + await speakWithGoogleTTS("Google TTS is working perfectly!"); + showToast('Success', 'Google TTS is configured', 'success'); } catch (error) { - showNeuralToast('Neural Synthesis Failed', - 'Check API key configuration. Using fallback synthesis.', 'error'); + showToast('Error', 'Check API key configuration', 'error'); } }); - // Clear configuration neural pathway document.getElementById('clearGoogleBtn').addEventListener('click', () => { document.getElementById('googleApiKey').value = ''; NeuralState.googleApiKey = ''; localStorage.removeItem('googleApiKey'); - showNeuralToast('Configuration Cleared', 'Google TTS cache purged.', 'success'); + showToast('Cleared', 'Google TTS cache cleared', 'success'); }); - // Training parameter neural pathways + // Training mode changes document.getElementById('trainingMode').addEventListener('change', () => { initTrainingSession(); - loadLexicalUnit(); + loadWord(); }); + document.getElementById('difficultyLevel').addEventListener('change', () => { initTrainingSession(); - loadLexicalUnit(); + loadWord(); + }); + + // Session slider + document.getElementById('sessionSlider').addEventListener('input', function() { + NeuralState.sessionLength = parseInt(this.value); + NeuralState.totalWords = NeuralState.sessionLength; + document.getElementById('sessionLengthValue').textContent = `${this.value} words`; + updateNeuralInterface(); }); - // Profile neural pathway + // Profile saving document.getElementById('saveProfileBtn').addEventListener('click', () => { NeuralState.userName = document.getElementById('userName').value; - NeuralState.userLevel = document.getElementById('userLevel').value; localStorage.setItem('userName', NeuralState.userName); - localStorage.setItem('userLevel', NeuralState.userLevel); - showNeuralToast('Profile Saved', `Neural identity: ${NeuralState.userName}`, 'success'); + showToast('Profile Saved', `Name: ${NeuralState.userName}`, 'success'); }); - // Slider control neural pathways + // Slider controls document.getElementById('speechRate').addEventListener('input', function() { NeuralState.speechRate = parseFloat(this.value); document.getElementById('rateValue').textContent = `${this.value}x`; }); + document.getElementById('speechPitch').addEventListener('input', function() { NeuralState.speechPitch = parseFloat(this.value); document.getElementById('pitchValue').textContent = this.value; }); + document.getElementById('masterVolume').addEventListener('input', function() { NeuralState.speechVolume = parseFloat(this.value); + soundManager.setVolume(NeuralState.speechVolume); document.getElementById('volumeValue').textContent = `${Math.round(this.value * 100)}%`; }); - // Keyboard neural shortcuts + // Settings + document.getElementById('autoPlayCheck').addEventListener('change', function() { + NeuralState.settings.autoPlay = this.checked; + saveSettings(); + }); + + document.getElementById('soundEffectsCheck').addEventListener('change', function() { + NeuralState.settings.soundEffects = this.checked; + saveSettings(); + }); + + document.getElementById('animationsCheck').addEventListener('change', function() { + NeuralState.settings.animations = this.checked; + saveSettings(); + }); + + document.getElementById('hintsEnabledCheck').addEventListener('change', function() { + NeuralState.settings.hintsEnabled = this.checked; + document.getElementById('hintBtn').disabled = !this.checked; + saveSettings(); + }); + + document.getElementById('spellOutEnabledCheck').addEventListener('change', function() { + NeuralState.settings.spellOutEnabled = this.checked; + document.getElementById('spellOutBtn').disabled = !this.checked; + saveSettings(); + }); + + // Sidebar toggle + document.getElementById('sidebarToggle').addEventListener('click', function() { + const sidebar = document.getElementById('neuralSidebar'); + sidebar.style.display = sidebar.style.display === 'none' ? 'flex' : 'none'; + this.innerHTML = sidebar.style.display === 'none' ? + '' : ''; + }); + + // Keyboard shortcuts document.addEventListener('keydown', function(e) { if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') { if (e.key !== 'Enter' && e.key !== 'Tab') return; } - const shortcuts = ['1', '2', '3', '4', '5', 'h', 'H', 'n', 'N', 'r', 'R', 'Enter']; - if (shortcuts.includes(e.key)) { - e.preventDefault(); - } + e.preventDefault(); - // Neural control mapping switch(e.key) { case '1': document.getElementById('hearWordBtn').click(); break; - case '2': if (!document.getElementById('contextBtn').disabled) - document.getElementById('contextBtn').click(); break; + case '2': document.getElementById('contextBtn').click(); break; case '3': document.getElementById('spellOutBtn').click(); break; case '4': document.getElementById('slowSpeechBtn').click(); break; case '5': document.getElementById('repeatBtn').click(); break; case 'h': - case 'H': if (!document.getElementById('hintBtn').disabled) - document.getElementById('hintBtn').click(); break; + case 'H': document.getElementById('hintBtn').click(); break; case 'n': - case 'N': if (!document.getElementById('nextWordBtn').disabled) - document.getElementById('nextWordBtn').click(); break; + case 'N': document.getElementById('nextWordBtn').click(); break; case 'r': case 'R': document.getElementById('revealBtn').click(); break; case 'Enter': if (!NeuralState.isCorrect) { document.getElementById('checkAnswerBtn').click(); - } else if (!document.getElementById('nextWordBtn').disabled) { + } else { document.getElementById('nextWordBtn').click(); } break; case 'Tab': e.preventDefault(); - if (!NeuralState.isCorrect) { - document.getElementById('hintBtn').click(); - } + document.getElementById('hintBtn').click(); break; } }); } - // ========== NEURAL PANEL ACTIVATION ========== - function activateNeuralPanel(panelId) { - // Update tab neural states + function activatePanel(panelId) { + // Update tabs document.querySelectorAll('.neural-tab').forEach(tab => { tab.classList.remove('active'); if (tab.getAttribute('data-tab') === panelId) { @@ -2532,325 +4587,17 @@ } }); - // Update panel neural states + // Update panels document.querySelectorAll('.neural-panel').forEach(panel => { panel.classList.remove('active'); if (panel.id === `${panelId}-panel`) { panel.classList.add('active'); } }); - - // Panel-specific neural initialization - if (panelId === 'analytics') { - updateQuickStats(); - renderNeuralHistory(); - renderNeuralBadges(); - } - } - - // ========== NEURAL TOAST SYSTEM ========== - function showNeuralToast(title, message, type = 'info') { - const toastContainer = document.getElementById('toastContainer'); - const toastId = 'neural-toast-' + Date.now(); - - const iconMap = { - success: '✅', - warning: 'âš ī¸', - error: '❌', - info: 'â„šī¸' - }; - - const toast = document.createElement('div'); - toast.className = `neural-toast ${type}`; - toast.id = toastId; - toast.innerHTML = ` -
${iconMap[type] || iconMap.info}
-
-
${title}
-
${message}
-
- - `; - - toastContainer.appendChild(toast); - - // Auto-purge after duration - setTimeout(() => { - const toastElement = document.getElementById(toastId); - if (toastElement) { - toastElement.style.opacity = '0'; - toastElement.style.transform = 'translateX(100%)'; - setTimeout(() => toastElement.remove(), 300); - } - }, 5000); - } - - // ========== NEURAL FEEDBACK SYSTEM ========== - function showNeuralFeedback(message, type) { - const feedback = document.getElementById('feedbackContainer'); - feedback.textContent = message; - feedback.className = `feedback-container ${type}`; - - setTimeout(() => { - feedback.className = 'feedback-container'; - }, 3000); - } - - // ========== NEURAL ACHIEVEMENT SYSTEM ========== - function checkNeuralAchievements() { - // Achievement validation logic - const achievements = NeuralState.badges.filter(badge => - !badge.earned && validateAchievement(badge.id)); - - if (achievements.length > 0) { - achievements.forEach(badge => { - badge.earned = true; - showNeuralToast('NEURAL ACHIEVEMENT UNLOCKED', - `${badge.icon} ${badge.name}: ${badge.description}`, 'success'); - }); - localStorage.setItem('badges', JSON.stringify(NeuralState.badges)); - } - } - - function validateAchievement(badgeId) { - switch(badgeId) { - case 1: return NeuralState.performance.currentStreak >= 10; - case 2: return NeuralState.performance.totalWordsCompleted >= 50; - case 3: return NeuralState.performance.totalWordsCompleted > 0 && - (NeuralState.performance.totalTime / NeuralState.performance.totalWordsCompleted) < 30; - case 4: return NeuralState.performance.totalWordsCompleted > 0 && - (NeuralState.performance.perfectFirstTries / NeuralState.performance.totalWordsCompleted) >= 0.9; - case 5: return NeuralState.sessionHistory.length > 0 && - NeuralState.sessionHistory.every(item => item.status === 'perfect'); - case 6: return NeuralState.performance.totalWordsCompleted >= 100; - case 7: return NeuralState.performance.currentStreak >= 20; - case 8: return NeuralState.sessionHistory.length > 0 && - NeuralState.sessionHistory.every(item => item.hints === 0); - case 9: return NeuralState.performance.totalWordsCompleted > 0 && - (NeuralState.performance.totalTime / NeuralState.performance.totalWordsCompleted) < 15; - default: return false; - } - } - - // ========== NEURAL COMPLETION MODAL ========== - function showNeuralCompletionModal() { - const modal = document.getElementById('sessionCompleteModal'); - const content = document.getElementById('modalContent'); - - // Calculate neural session metrics - const perfectCount = NeuralState.sessionHistory.filter(item => item.status === 'perfect').length; - const precision = NeuralState.sessionHistory.length > 0 ? - Math.round((perfectCount / NeuralState.sessionHistory.length) * 100) : 0; - - content.innerHTML = ` -
-
🧠
-

NEURAL SESSION COMPLETE

-

- Neural training protocol executed successfully. ${NeuralState.totalWords} lexical units processed. -

- -
-
-
${NeuralState.score}
-
NEURAL SCORE
-
-
-
${precision}%
-
NEURAL PRECISION
-
-
-
${perfectCount}
-
OPTIMAL UNITS
-
-
-
${Math.floor(NeuralState.sessionTime / 60)}m
-
TEMPORAL INVESTMENT
-
-
- -
- - - -
-
- `; - - modal.classList.add('active'); - - // Modal neural pathways - document.getElementById('newSessionModalBtn').addEventListener('click', () => { - completeNeuralSession(); - modal.classList.remove('active'); - }); - - document.getElementById('reviewSessionBtn').addEventListener('click', () => { - activateNeuralPanel('analytics'); - modal.classList.remove('active'); - }); - - document.getElementById('shareResultsBtn').addEventListener('click', exportNeuralData); } - function completeNeuralSession() { - // Update performance metrics - NeuralState.performance.totalSessions++; - NeuralState.performance.totalTime += NeuralState.sessionTime; - - // Cache performance data - localStorage.setItem('totalSessions', NeuralState.performance.totalSessions); - localStorage.setItem('totalWordsCompleted', NeuralState.performance.totalWordsCompleted); - localStorage.setItem('perfectFirstTries', NeuralState.performance.perfectFirstTries); - localStorage.setItem('hintCorrect', NeuralState.performance.hintCorrect); - localStorage.setItem('incorrect', NeuralState.performance.incorrect); - localStorage.setItem('totalTime', NeuralState.performance.totalTime); - localStorage.setItem('longestStreak', NeuralState.performance.longestStreak); - - // Initialize new neural session - initTrainingSession(); - loadLexicalUnit(); - - // Reset temporal tracking - NeuralState.startTime = Date.now(); - NeuralState.sessionTime = 0; - - showNeuralToast('Neural Session Initialized', 'New training protocol engaged.', 'success'); - } - - // ========== NEURAL DATA EXPORT ========== - function exportNeuralData() { - const neuralData = { - profile: { - name: NeuralState.userName, - level: NeuralState.userLevel, - xp: NeuralState.userXP - }, - performance: NeuralState.performance, - achievements: NeuralState.badges.filter(b => b.earned), - history: NeuralState.history, - timestamp: Date.now() - }; - - const dataStr = JSON.stringify(neuralData, null, 2); - const dataUri = 'data:application/json;charset=utf-8,'+ encodeURIComponent(dataStr); - const fileName = `neural-spelling-data-${new Date().toISOString().split('T')[0]}.json`; - - const downloadLink = document.createElement('a'); - downloadLink.setAttribute('href', dataUri); - downloadLink.setAttribute('download', fileName); - downloadLink.click(); - - showNeuralToast('Neural Data Exported', 'Complete neural profile downloaded.', 'success'); - } - - // ========== NEURAL STATISTICS RENDERER ========== - function updateQuickStats() { - const container = document.getElementById('quickStats'); - if (!container) return; - - const precision = NeuralState.performance.totalWordsCompleted > 0 ? - Math.round((NeuralState.performance.perfectFirstTries / NeuralState.performance.totalWordsCompleted) * 100) : 0; - - container.innerHTML = ` -
- Neural Tier: - ${NeuralState.userLevel.toUpperCase()} -
-
- Neural XP: - ${NeuralState.userXP} -
-
- Units Processed: - ${NeuralState.performance.totalWordsCompleted} -
-
- Neural Precision: - ${precision}% -
-
- Optimal Streak: - ${NeuralState.performance.longestStreak} -
- `; - } - - // ========== NEURAL BADGES RENDERER ========== - function renderNeuralBadges() { - const container = document.getElementById('badgesGrid'); - if (!container) return; - - container.innerHTML = ''; - - // Load cached achievements - const cachedBadges = JSON.parse(localStorage.getItem('badges')); - if (cachedBadges) { - NeuralState.badges = cachedBadges; - } - - NeuralState.badges.forEach(badge => { - const badgeElement = document.createElement('div'); - badgeElement.className = `neural-badge ${badge.earned ? 'earned' : 'locked'}`; - badgeElement.innerHTML = ` -
${badge.icon}
-
${badge.name}
-
${badge.description}
- `; - - container.appendChild(badgeElement); - }); - } - - // ========== NEURAL HISTORY RENDERER ========== - function renderNeuralHistory() { - const container = document.getElementById('wordHistory'); - if (!container) return; - - container.innerHTML = ''; - - // Display recent 10 neural entries - const recentHistory = NeuralState.history.slice(0, 10); - - if (recentHistory.length === 0) { - container.innerHTML = ` -
- -
Neural history empty
-
Complete training to populate neural cache
-
- `; - return; - } - - recentHistory.forEach(item => { - const historyElement = document.createElement('div'); - historyElement.className = `history-item ${item.status === 'hint' ? 'hint' : ''}`; - historyElement.innerHTML = ` -
-
${'█'.repeat(item.word.length)}
-
- - ${item.status === 'perfect' ? '⭐' : '💡'} - - +${item.points} -
-
-
- ${item.attempts} attempt${item.attempts > 1 ? 's' : ''} - ${item.hints} hint${item.hints !== 1 ? 's' : ''} - ${item.time}s -
- `; - - container.appendChild(historyElement); - }); + function saveSettings() { + localStorage.setItem('settings', JSON.stringify(NeuralState.settings)); } // ========== TEMPORAL TRACKER ========== @@ -2863,9 +4610,9 @@ }, 1000); } - // ========== GLOBAL NEURAL FUNCTIONS ========== - window.showNeuralToast = showNeuralToast; - window.activateNeuralPanel = activateNeuralPanel; + // ========== GLOBAL FUNCTIONS ========== + window.showToast = showToast; + window.activatePanel = activatePanel; \ No newline at end of file