Download index.html from NEXA2/TAFAKOR: direct link, hf CLI and curl.
- Browser
- Download file 159 kB
-
https://huggingface.co/spaces/NEXA2/TAFAKOR/resolve/main/index.html
- Command line
-
hf download hf://spaces/NEXA2/TAFAKOR/index.html
-
curl -L -o index.html https://huggingface.co/spaces/NEXA2/TAFAKOR/resolve/main/index.html
159 kB
<!DOCTYPE html>
<html lang="fa" dir="rtl" data-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>🧠 تفکر و رسانه | نسخه ۲.۰</title>
<link href="https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css" rel="stylesheet">
<style>
:root {
--primary: #6C63FF;
--primary-dark: #5A52D5;
--secondary: #FF6584;
--accent: #00D2FF;
--accent2: #FFD93D;
--success: #00C853;
--danger: #FF5252;
--dark: #1a1a2e;
--darker: #16213e;
--card: #0f3460;
--text: #e8e8e8;
--text-dim: #a0a0b0;
--glass: rgba(255,255,255,0.06);
--glass-border: rgba(255,255,255,0.1);
--radius: 16px;
--shadow: 0 8px 32px rgba(0,0,0,0.3);
--font-size: 16px;
}
[data-theme="light"] {
--dark: #f5f5f7;
--darker: #ffffff;
--card: #ffffff;
--text: #1a1a2e;
--text-dim: #666;
--glass: rgba(0,0,0,0.04);
--glass-border: rgba(0,0,0,0.1);
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
font-family: 'Vazirmatn', sans-serif;
background: var(--dark);
color: var(--text);
min-height: 100vh;
overflow-x: hidden;
font-size: var(--font-size);
transition: background 0.3s, color 0.3s;
}
.bg-animation { position: fixed; top:0; left:0; width:100%; height:100%; z-index: 0; overflow: hidden; pointer-events: none; }
.bg-animation .orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.3; animation: orbFloat 20s ease-in-out infinite; }
.bg-animation .orb:nth-child(1) { width:400px; height:400px; background:var(--primary); top:-100px; right:-100px; }
.bg-animation .orb:nth-child(2) { width:300px; height:300px; background:var(--secondary); bottom:-50px; left:-50px; animation-delay:-7s; }
.bg-animation .orb:nth-child(3) { width:350px; height:350px; background:var(--accent); top:50%; left:50%; animation-delay:-14s; }
@keyframes orbFloat { 0%,100% { transform: translate(0,0) scale(1); } 25% { transform: translate(50px,-80px) scale(1.1); } 50% { transform: translate(-30px,60px) scale(0.9); } 75% { transform: translate(70px,30px) scale(1.05); } }
.particles { position:fixed; top:0; left:0; width:100%; height:100%; z-index:0; pointer-events:none; }
.particle { position:absolute; width:4px; height:4px; background:var(--accent); border-radius:50%; opacity:0; animation: particleAnim linear infinite; }
@keyframes particleAnim { 0% { opacity:0; transform:translateY(100vh) scale(0); } 10% { opacity:0.8; } 90% { opacity:0.8; } 100% { opacity:0; transform:translateY(-10vh) scale(1); } }
.app { position:relative; z-index:1; }
.nav { position:fixed; top:0; left:0; right:0; z-index:100; background: rgba(26,26,46,0.85); backdrop-filter:blur(20px); border-bottom:1px solid var(--glass-border); padding:0 20px; height:64px; display:flex; align-items:center; justify-content:space-between; }
[data-theme="light"] .nav { background: rgba(255,255,255,0.85); }
.nav-brand { display:flex; align-items:center; gap:10px; font-size:1.2em; font-weight:700; }
.nav-brand svg { width:36px; height:36px; }
.nav-links { display:flex; gap:4px; }
.nav-link { padding:8px 16px; border-radius:12px; cursor:pointer; transition:all 0.3s; font-size:0.9em; border:none; background:transparent; color:var(--text-dim); font-family:inherit; }
.nav-link:hover, .nav-link.active { background:var(--glass); color:var(--accent); }
.nav-stats { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.stat-badge { display:flex; align-items:center; gap:6px; padding:6px 12px; background:var(--glass); border-radius:20px; font-size:0.85em; }
.stat-badge .icon { font-size:1.1em; }
.progress-bar-container { position:fixed; top:64px; left:0; right:0; height:4px; background:rgba(255,255,255,0.05); z-index:99; }
.progress-bar { height:100%; background:linear-gradient(90deg, var(--primary), var(--accent), var(--secondary)); border-radius:0 2px 2px 0; transition:width 0.5s ease; box-shadow:0 0 10px var(--accent); }
.main { padding-top:80px; min-height:100vh; }
.section { display:none; padding:20px; max-width:1200px; margin:0 auto; }
.section.active { display:block; animation:fadeInSection 0.5s ease; }
@keyframes fadeInSection { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
.hero { text-align:center; padding:60px 20px; background:linear-gradient(135deg, rgba(108,99,255,0.15), rgba(0,210,255,0.1)); border-radius:24px; margin-bottom:40px; border:1px solid var(--glass-border); position:relative; overflow:hidden; }
.hero::before { content:''; position:absolute; top:-50%; left:-50%; width:200%; height:200%; background:conic-gradient(from 0deg, transparent, rgba(108,99,255,0.1), transparent, rgba(0,210,255,0.1), transparent); animation:heroRotate 15s linear infinite; }
@keyframes heroRotate { to { transform:rotate(360deg); } }
.hero-content { position:relative; z-index:1; }
.hero h1 { font-size:2.5em; margin-bottom:16px; background:linear-gradient(135deg, var(--accent), var(--primary), var(--secondary)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.hero p { font-size:1.1em; color:var(--text-dim); max-width:600px; margin:0 auto 30px; line-height:1.8; }
.hero-btns { display:flex; gap:16px; justify-content:center; flex-wrap:wrap; }
.btn { padding:12px 28px; border-radius:14px; border:none; cursor:pointer; font-family:inherit; font-size:1em; font-weight:600; transition:all 0.3s; display:inline-flex; align-items:center; gap:8px; }
.btn-primary { background:linear-gradient(135deg, var(--primary), var(--primary-dark)); color:#fff; box-shadow:0 4px 15px rgba(108,99,255,0.4); }
.btn-primary:hover { transform:translateY(-2px); box-shadow:0 6px 20px rgba(108,99,255,0.6); }
.btn-secondary { background:var(--glass); color:var(--text); border:1px solid var(--glass-border); }
.btn-secondary:hover { background:rgba(255,255,255,0.1); }
.btn-success { background:linear-gradient(135deg, var(--success), #00a844); color:#fff; }
.btn-danger { background:linear-gradient(135deg, var(--danger), #d32f2f); color:#fff; }
.btn-accent { background:linear-gradient(135deg, var(--accent), #0099cc); color:#fff; }
.btn-sm { padding:8px 16px; font-size:0.85em; border-radius:10px; }
.btn-lg { padding:16px 36px; font-size:1.1em; border-radius:16px; }
.cards-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(280px,1fr)); gap:20px; margin:30px 0; }
.card { background:var(--glass); border:1px solid var(--glass-border); border-radius:var(--radius); padding:24px; transition:all 0.3s; cursor:pointer; position:relative; overflow:hidden; }
.card:hover { transform:translateY(-4px); border-color:var(--primary); box-shadow:var(--shadow); }
.card-icon { font-size:2.5em; margin-bottom:16px; }
.card h3 { font-size:1.2em; margin-bottom:8px; }
.card p { color:var(--text-dim); font-size:0.9em; line-height:1.7; }
.card-badge { position:absolute; top:12px; left:12px; padding:4px 10px; border-radius:8px; font-size:0.75em; font-weight:600; }
.card-progress { margin-top:16px; }
.card-progress-bar { height:6px; background:rgba(255,255,255,0.1); border-radius:3px; overflow:hidden; }
.card-progress-fill { height:100%; border-radius:3px; transition:width 0.5s; }
.daily-challenge-card { background:linear-gradient(135deg, rgba(255,101,132,0.15), rgba(255,217,61,0.1)); border:1px solid rgba(255,101,132,0.3); border-radius:var(--radius); padding:20px; margin-bottom:30px; }
.challenge-header { display:flex; align-items:center; gap:16px; margin-bottom:12px; flex-wrap:wrap; }
.challenge-icon { font-size:2em; }
.challenge-header h3 { font-size:1.1em; margin-bottom:4px; }
.challenge-header p { color:var(--text-dim); font-size:0.9em; flex:1; min-width:200px; }
.challenge-progress { height:6px; background:rgba(255,255,255,0.1); border-radius:3px; overflow:hidden; }
.challenge-progress-bar { height:100%; background:linear-gradient(90deg, var(--secondary), var(--accent2)); border-radius:3px; transition:width 0.5s; }
.lesson-header { display:flex; align-items:center; gap:16px; margin-bottom:30px; padding:24px; background:var(--glass); border-radius:var(--radius); border:1px solid var(--glass-border); flex-wrap:wrap; }
.lesson-header .lesson-icon { font-size:3em; }
.lesson-header h2 { font-size:1.6em; }
.lesson-header .lesson-meta { color:var(--text-dim); font-size:0.9em; margin-top:4px; }
.lesson-content { background:var(--glass); border:1px solid var(--glass-border); border-radius:var(--radius); padding:32px; margin-bottom:24px; line-height:2; font-size:1.05em; }
.lesson-content h3 { color:var(--accent); margin:24px 0 12px; font-size:1.3em; }
.lesson-content h4 { color:var(--accent2); margin:20px 0 10px; font-size:1.1em; }
.lesson-content ul, .lesson-content ol { padding-right:24px; margin:12px 0; }
.lesson-content li { margin:8px 0; }
.lesson-content .highlight { background:linear-gradient(135deg, rgba(108,99,255,0.2), rgba(0,210,255,0.1)); border:1px solid rgba(108,99,255,0.3); border-radius:12px; padding:16px 20px; margin:16px 0; }
.lesson-content .key-point { background:linear-gradient(135deg, rgba(255,101,132,0.15), rgba(255,217,61,0.1)); border-right:4px solid var(--secondary); border-radius:0 12px 12px 0; padding:16px 20px; margin:16px 0; }
.lesson-content .definition { background:rgba(0,210,255,0.1); border:1px solid rgba(0,210,255,0.2); border-radius:12px; padding:16px 20px; margin:16px 0; }
.lesson-content .definition strong { color:var(--accent); }
.lesson-content .example { background:rgba(255,217,61,0.1); border:1px solid rgba(255,217,61,0.2); border-radius:12px; padding:16px 20px; margin:16px 0; }
.lesson-content .example::before { content:'💡 مثال: '; font-weight:700; color:var(--accent2); }
.interactive-box { background:linear-gradient(135deg, rgba(108,99,255,0.1), rgba(0,210,255,0.05)); border:2px dashed var(--primary); border-radius:16px; padding:24px; margin:20px 0; text-align:center; }
.interactive-box h4 { color:var(--primary); margin-bottom:12px; }
.search-box { display:flex; align-items:center; }
.search-box input { padding:10px 16px; border-radius:12px; border:1px solid var(--glass-border); background:var(--glass); color:var(--text); font-family:inherit; font-size:0.9em; outline:none; min-width:250px; max-width:100%; }
.search-box input:focus { border-color:var(--primary); }
.tabs { display:flex; gap:4px; margin-bottom:20px; flex-wrap:wrap; }
.tab { padding:10px 20px; border-radius:12px; cursor:pointer; background:var(--glass); border:1px solid var(--glass-border); transition:all 0.3s; font-family:inherit; color:var(--text-dim); font-size:0.9em; }
.tab.active { background:var(--primary); color:#fff; border-color:var(--primary); }
.tab:hover:not(.active) { border-color:var(--primary); color:var(--text); }
.flashcard-container { perspective:1000px; width:100%; max-width:500px; margin:30px auto; height:280px; }
.flashcard { width:100%; height:100%; position:relative; transform-style:preserve-3d; transition:transform 0.6s; cursor:pointer; }
.flashcard.flipped { transform:rotateY(180deg); }
.flashcard-face { position:absolute; width:100%; height:100%; backface-visibility:hidden; border-radius:20px; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:30px; text-align:center; }
.flashcard-front { background:linear-gradient(135deg, var(--primary), var(--card)); border:2px solid var(--primary); }
.flashcard-back { background:linear-gradient(135deg, var(--card), var(--darker)); border:2px solid var(--accent); transform:rotateY(180deg); }
.flashcard-face h3 { font-size:1.3em; margin-bottom:12px; }
.flashcard-face p { color:var(--text-dim); line-height:1.8; }
.quiz-container { max-width:800px; margin:0 auto; }
.quiz-header { display:flex; justify-content:space-between; align-items:center; padding:20px; background:var(--glass); border-radius:var(--radius); margin-bottom:20px; border:1px solid var(--glass-border); flex-wrap:wrap; gap:12px; }
.quiz-progress { display:flex; align-items:center; gap:12px; }
.quiz-timer { font-size:1.2em; font-weight:700; color:var(--accent); }
.quiz-question { background:var(--glass); border:1px solid var(--glass-border); border-radius:var(--radius); padding:30px; margin-bottom:20px; }
.quiz-question .q-number { color:var(--accent); font-size:0.9em; margin-bottom:8px; }
.quiz-question .q-type { display:inline-block; padding:4px 10px; border-radius:8px; font-size:0.75em; margin-bottom:12px; }
.quiz-question .q-text { font-size:1.15em; line-height:1.8; margin-bottom:20px; }
.quiz-options { display:flex; flex-direction:column; gap:10px; }
.quiz-option { padding:14px 20px; border-radius:12px; border:2px solid var(--glass-border); cursor:pointer; transition:all 0.3s; display:flex; align-items:center; gap:12px; background:var(--glass); }
.quiz-option:hover { border-color:var(--primary); background:rgba(108,99,255,0.1); }
.quiz-option.selected { border-color:var(--primary); background:rgba(108,99,255,0.2); }
.quiz-option.correct { border-color:var(--success); background:rgba(0,200,83,0.2); }
.quiz-option.wrong { border-color:var(--danger); background:rgba(255,82,82,0.2); }
.quiz-option .opt-letter { width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:700; background:rgba(255,255,255,0.1); font-size:0.9em; flex-shrink:0; }
.quiz-explanation { margin-top:16px; padding:16px; border-radius:12px; background:rgba(0,210,255,0.1); border:1px solid rgba(0,210,255,0.2); display:none; line-height:1.8; }
.quiz-explanation.show { display:block; animation:fadeIn 0.3s; }
.ai-chat { position:fixed; bottom:20px; left:20px; z-index:200; }
.ai-toggle { width:60px; height:60px; border-radius:50%; border:none; background:linear-gradient(135deg, var(--primary), var(--accent)); color:#fff; font-size:1.5em; cursor:pointer; box-shadow:0 4px 20px rgba(108,99,255,0.5); transition:all 0.3s; display:flex; align-items:center; justify-content:center; }
.ai-toggle:hover { transform:scale(1.1); }
.ai-panel { position:absolute; bottom:70px; left:0; width:380px; max-height:500px; background:var(--darker); border:1px solid var(--glass-border); border-radius:20px; overflow:hidden; display:none; box-shadow:0 10px 40px rgba(0,0,0,0.5); animation:slideUp 0.3s ease; }
.ai-panel.open { display:flex; flex-direction:column; }
@keyframes slideUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
.ai-panel-header { padding:16px 20px; background:linear-gradient(135deg, var(--primary), var(--card)); display:flex; align-items:center; gap:10px; }
.ai-panel-header h4 { font-size:1em; flex:1; }
.ai-close { background:none; border:none; color:var(--text); cursor:pointer; font-size:1.2em; }
.ai-messages { flex:1; overflow-y:auto; padding:16px; max-height:350px; }
.ai-msg { margin:10px 0; display:flex; gap:8px; }
.ai-msg.bot .msg-bubble { background:var(--glass); border-radius:0 12px 12px 12px; padding:12px 16px; max-width:85%; white-space:pre-wrap; }
.ai-msg.user { flex-direction:row-reverse; }
.ai-msg.user .msg-bubble { background:rgba(108,99,255,0.3); border-radius:12px 0 12px 12px; padding:12px 16px; max-width:85%; }
.ai-suggestions { display:flex; gap:6px; padding:8px 12px; flex-wrap:wrap; border-top:1px solid var(--glass-border); }
.ai-suggestion { padding:6px 12px; border-radius:12px; border:1px solid var(--glass-border); background:var(--glass); color:var(--text-dim); font-size:0.8em; cursor:pointer; transition:all 0.3s; font-family:inherit; }
.ai-suggestion:hover { border-color:var(--primary); color:var(--text); }
.ai-input-area { display:flex; gap:8px; padding:12px; border-top:1px solid var(--glass-border); }
.ai-input-area input { flex:1; padding:10px 16px; border-radius:12px; border:1px solid var(--glass-border); background:var(--glass); color:var(--text); font-family:inherit; font-size:0.9em; outline:none; }
.ai-input-area input:focus { border-color:var(--primary); }
.ai-input-area button { padding:10px 16px; border-radius:12px; border:none; background:var(--primary); color:#fff; cursor:pointer; }
.results-container { text-align:center; padding:40px 20px; }
.results-score { width:200px; height:200px; border-radius:50%; margin:30px auto; display:flex; flex-direction:column; align-items:center; justify-content:center; font-size:3em; font-weight:700; position:relative; }
.results-score::before { content:''; position:absolute; inset:-4px; border-radius:50%; background:conic-gradient(var(--success) var(--score-pct), rgba(255,255,255,0.1) 0); }
.results-score::after { content:''; position:absolute; inset:0; border-radius:50%; background:var(--darker); }
.results-score span { position:relative; z-index:1; }
.results-score small { font-size:0.3em; color:var(--text-dim); position:relative; z-index:1; }
.streak-display { display:flex; align-items:center; gap:8px; padding:8px 16px; background:linear-gradient(135deg, rgba(255,101,132,0.2), rgba(255,217,61,0.1)); border-radius:12px; border:1px solid rgba(255,101,132,0.3); }
.streak-fire { font-size:1.3em; animation:pulse 1s ease-in-out infinite; }
.match-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(140px,1fr)); gap:10px; margin:20px 0; }
.match-card { padding:16px; border-radius:12px; text-align:center; cursor:pointer; background:var(--glass); border:2px solid var(--glass-border); transition:all 0.3s; font-size:0.9em; min-height:80px; display:flex; align-items:center; justify-content:center; }
.match-card:hover { border-color:var(--primary); }
.match-card.selected { border-color:var(--accent); background:rgba(0,210,255,0.15); }
.match-card.matched { border-color:var(--success); background:rgba(0,200,83,0.15); pointer-events:none; }
.match-card.wrong { border-color:var(--danger); background:rgba(255,82,82,0.15); animation:shake 0.3s; }
@keyframes shake { 0%,100% { transform:translateX(0); } 25% { transform:translateX(-5px); } 75% { transform:translateX(5px); } }
.fill-blank-input { display:inline-block; min-width:120px; padding:4px 12px; border:none; border-bottom:2px solid var(--primary); background:transparent; color:var(--accent); font-family:inherit; font-size:1em; text-align:center; outline:none; }
.fill-blank-input:focus { border-bottom-color:var(--accent); }
.fill-blank-input.correct { border-bottom-color:var(--success); color:var(--success); }
.fill-blank-input.wrong { border-bottom-color:var(--danger); color:var(--danger); }
.tf-buttons { display:flex; gap:16px; justify-content:center; margin:20px 0; flex-wrap:wrap; }
.tf-btn { padding:16px 40px; border-radius:14px; border:2px solid var(--glass-border); background:var(--glass); cursor:pointer; font-family:inherit; font-size:1.1em; font-weight:600; transition:all 0.3s; color:var(--text); }
.tf-btn:hover { transform:scale(1.05); }
.tf-btn.true-btn:hover { border-color:var(--success); color:var(--success); }
.tf-btn.false-btn:hover { border-color:var(--danger); color:var(--danger); }
.order-list { list-style:none; }
.order-item { padding:14px 20px; margin:8px 0; border-radius:12px; background:var(--glass); border:1px solid var(--glass-border); cursor:grab; display:flex; align-items:center; gap:12px; transition:all 0.2s; }
.order-item:active { cursor:grabbing; }
.order-item .order-num { width:28px; height:28px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:700; background:var(--primary); font-size:0.85em; }
.memory-grid { display:grid; grid-template-columns:repeat(4, 1fr); gap:10px; margin:20px auto; max-width:500px; }
.memory-card { aspect-ratio:1; border-radius:12px; cursor:pointer; background:var(--glass); border:2px solid var(--glass-border); transition:all 0.3s; display:flex; align-items:center; justify-content:center; font-size:1.2em; position:relative; padding:8px; text-align:center; }
.memory-card.flipped { background:rgba(108,99,255,0.2); border-color:var(--primary); }
.memory-card.matched { background:rgba(0,200,83,0.2); border-color:var(--success); pointer-events:none; }
.memory-card .card-back { display:none; }
.memory-card.flipped .card-back { display:block; }
.memory-card .card-front { display:block; }
.memory-card.flipped .card-front { display:none; }
.achievement { display:flex; align-items:center; gap:16px; padding:16px; background:var(--glass); border:1px solid var(--glass-border); border-radius:12px; margin:8px 0; transition:all 0.3s; }
.achievement.unlocked { border-color:var(--accent2); background:rgba(255,217,61,0.1); }
.achievement .ach-icon { font-size:2em; }
.achievement .ach-info h4 { font-size:0.95em; }
.achievement .ach-info p { font-size:0.8em; color:var(--text-dim); }
.profile-header { background:linear-gradient(135deg, rgba(108,99,255,0.2), rgba(0,210,255,0.1)); border:1px solid var(--glass-border); border-radius:var(--radius); padding:30px; text-align:center; margin-bottom:20px; }
.profile-avatar { width:120px; height:120px; border-radius:50%; background:linear-gradient(135deg, var(--primary), var(--accent)); display:flex; align-items:center; justify-content:center; font-size:3em; margin:0 auto 16px; border:4px solid var(--glass-border); }
.profile-name { font-size:1.5em; margin-bottom:8px; }
.profile-level { color:var(--accent); font-size:1.1em; margin-bottom:16px; }
.profile-xp-bar { height:12px; background:rgba(255,255,255,0.1); border-radius:6px; overflow:hidden; margin:12px 0; }
.profile-xp-fill { height:100%; background:linear-gradient(90deg, var(--primary), var(--accent)); border-radius:6px; transition:width 0.5s; }
.profile-stats { display:grid; grid-template-columns:repeat(auto-fit, minmax(120px, 1fr)); gap:12px; margin-top:20px; }
.profile-stat { background:var(--glass); border:1px solid var(--glass-border); border-radius:12px; padding:16px; text-align:center; }
.profile-stat .stat-value { font-size:1.5em; font-weight:700; color:var(--accent); }
.profile-stat .stat-label { font-size:0.85em; color:var(--text-dim); margin-top:4px; }
.modal { display:none; position:fixed; inset:0; z-index:1000; background:rgba(0,0,0,0.7); backdrop-filter:blur(10px); align-items:center; justify-content:center; }
.modal.open { display:flex; animation:fadeIn 0.3s; }
.modal-content { background:var(--darker); border:1px solid var(--glass-border); border-radius:20px; max-width:500px; width:90%; max-height:80vh; overflow-y:auto; animation:bounceIn 0.5s; }
.modal-header { padding:20px; border-bottom:1px solid var(--glass-border); display:flex; justify-content:space-between; align-items:center; }
.modal-header h3 { font-size:1.3em; }
.modal-close { background:none; border:none; color:var(--text); cursor:pointer; font-size:1.5em; }
.modal-body { padding:20px; }
#notifications { position:fixed; top:80px; left:50%; transform:translateX(-50%); z-index:300; display:flex; flex-direction:column; gap:8px; max-width:90vw; }
.notification { padding:14px 28px; border-radius:14px; animation:slideDown 0.3s ease; font-weight:600; box-shadow:0 4px 20px rgba(0,0,0,0.3); display:flex; align-items:center; gap:10px; }
@keyframes slideDown { from { transform:translateY(-20px); opacity:0; } to { transform:translateY(0); opacity:1; } }
.notification.success { background:var(--success); color:#fff; }
.notification.error { background:var(--danger); color:#fff; }
.notification.info { background:var(--primary); color:#fff; }
.notification.warning { background:var(--accent2); color:#000; }
.confetti-piece { position:fixed; width:10px; height:10px; z-index:300; animation:confettiFall 3s ease-in forwards; }
@keyframes confettiFall { 0% { transform:translateY(-100px) rotate(0deg); opacity:1; } 100% { transform:translateY(100vh) rotate(720deg); opacity:0; } }
::-webkit-scrollbar { width:8px; }
::-webkit-scrollbar-track { background:var(--dark); }
::-webkit-scrollbar-thumb { background:var(--primary); border-radius:4px; }
.mindmap-container { background:var(--glass); border:1px solid var(--glass-border); border-radius:var(--radius); padding:30px; margin:20px 0; min-height:400px; position:relative; overflow:hidden; }
.mindmap-node { position:absolute; padding:12px 20px; border-radius:12px; font-size:0.85em; font-weight:600; cursor:pointer; transition:all 0.3s; text-align:center; min-width:100px; }
.mindmap-node:hover { transform:scale(1.1); z-index:10; }
.mindmap-center { background:linear-gradient(135deg, var(--primary), var(--accent)); color:#fff; font-size:1em; }
.mindmap-branch { background:var(--glass); border:2px solid; }
.activity-list { background:var(--glass); border:1px solid var(--glass-border); border-radius:var(--radius); padding:20px; }
.activity-item { display:flex; align-items:center; gap:12px; padding:12px; border-bottom:1px solid var(--glass-border); }
.activity-item:last-child { border-bottom:none; }
.activity-icon { font-size:1.5em; }
.activity-info { flex:1; }
.activity-info h4 { font-size:0.95em; margin-bottom:4px; }
.activity-info p { font-size:0.8em; color:var(--text-dim); }
.svg-illustration { max-width:100%; margin:20px auto; display:block; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes bounceIn { 0% { transform:scale(0); } 50% { transform:scale(1.1); } 100% { transform:scale(1); } }
@keyframes pulse { 0%,100% { transform:scale(1); } 50% { transform:scale(1.05); } }
.xp-popup { position:fixed; top:50%; left:50%; transform:translate(-50%, -50%); font-size:2em; font-weight:700; color:var(--accent2); text-shadow:0 0 20px var(--accent2); pointer-events:none; animation:xpPopup 1.5s ease-out forwards; z-index:500; }
@keyframes xpPopup { 0% { opacity:0; transform:translate(-50%, -50%) scale(0.5); } 20% { opacity:1; transform:translate(-50%, -70%) scale(1.2); } 100% { opacity:0; transform:translate(-50%, -150%) scale(1); } }
.mobile-nav { display:none; position:fixed; bottom:0; left:0; right:0; background:rgba(26,26,46,0.95); backdrop-filter:blur(20px); border-top:1px solid var(--glass-border); z-index:100; padding:8px 0; }
@media (max-width:768px) {
.mobile-nav { display:flex; justify-content:space-around; }
.main { padding-bottom:80px; }
.nav-links { display:none; }
.hero h1 { font-size:1.8em; }
.cards-grid { grid-template-columns:1fr; }
.ai-panel { width:calc(100vw - 40px); left:-10px; }
.quiz-question { padding:20px; }
.lesson-content { padding:20px; }
.nav-stats { gap:4px; }
.stat-badge { padding:4px 8px; font-size:0.75em; }
.streak-display { padding:6px 10px; }
.memory-grid { grid-template-columns:repeat(3, 1fr); }
}
.mobile-nav-item { display:flex; flex-direction:column; align-items:center; gap:4px; padding:8px 12px; border-radius:12px; cursor:pointer; color:var(--text-dim); font-size:0.7em; border:none; background:none; font-family:inherit; transition:all 0.3s; }
.mobile-nav-item.active { color:var(--accent); }
.mobile-nav-item .m-icon { font-size:1.4em; }
</style>
</head>
<body>
<div class="bg-animation">
<div class="orb"></div><div class="orb"></div><div class="orb"></div>
</div>
<div class="particles" id="particles"></div>
<div class="app">
<nav class="nav">
<div class="nav-brand">
<svg viewBox="0 0 36 36" fill="none">
<circle cx="18" cy="18" r="16" stroke="url(#g1)" stroke-width="2"/>
<path d="M12 18c0-3.3 2.7-6 6-6s6 2.7 6 6-2.7 6-6 6" stroke="url(#g1)" stroke-width="2" stroke-linecap="round"/>
<circle cx="18" cy="18" r="2" fill="#6C63FF"/>
<defs><linearGradient id="g1" x1="0" y1="0" x2="36" y2="36"><stop stop-color="#6C63FF"/><stop offset="1" stop-color="#00D2FF"/></linearGradient></defs>
</svg>
<span>تفکر و رسانه <small style="opacity:0.6">v2.0</small></span>
</div>
<div class="nav-links">
<button class="nav-link active" data-section="home">🏠 خانه</button>
<button class="nav-link" data-section="lessons">📚 درسها</button>
<button class="nav-link" data-section="quiz">📝 آزمون</button>
<button class="nav-link" data-section="games">🎮 بازی</button>
<button class="nav-link" data-section="review">📊 مرور</button>
<button class="nav-link" data-section="profile">👤 پروفایل</button>
</div>
<div class="nav-stats">
<div class="stat-badge" title="سطح">
<span class="icon">⭐</span>
<span>Lv.<span id="userLevel">1</span></span>
</div>
<div class="stat-badge" title="سکه">
<span class="icon">🪙</span>
<span id="userCoins">0</span>
</div>
<div class="streak-display" title="روزهای متوالی">
<span class="streak-fire">🔥</span>
<span id="streakCount">0</span>
</div>
<div class="stat-badge" title="امتیاز کل">
<span class="icon">💎</span>
<span id="totalScore">0</span>
</div>
</div>
</nav>
<div class="progress-bar-container">
<div class="progress-bar" id="mainProgress" style="width:0%"></div>
</div>
<div class="main">
<div class="section active" id="sec-home">
<div class="hero">
<div class="hero-content">
<h1>🧠 تفکر و رسانه</h1>
<p>سفری تعاملی در دنیای رسانه، سواد رسانهای و تفکر انتقادی. نسخه ۲.۰ با امکانات پیشرفته!</p>
<svg class="svg-illustration" viewBox="0 0 600 250" width="500">
<defs>
<linearGradient id="hg1" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#6C63FF" stop-opacity="0.8"/>
<stop offset="100%" stop-color="#00D2FF" stop-opacity="0.8"/>
</linearGradient>
</defs>
<ellipse cx="300" cy="120" rx="80" ry="70" fill="none" stroke="url(#hg1)" stroke-width="3">
<animate attributeName="rx" values="80;85;80" dur="3s" repeatCount="indefinite"/>
</ellipse>
<path d="M260 100 Q280 70 300 80 Q320 70 340 100" fill="none" stroke="url(#hg1)" stroke-width="2"/>
<path d="M260 130 Q280 160 300 150 Q320 160 340 130" fill="none" stroke="url(#hg1)" stroke-width="2"/>
<line x1="300" y1="80" x2="300" y2="150" stroke="url(#hg1)" stroke-width="1.5" stroke-dasharray="4"/>
<rect x="120" y="60" width="40" height="30" rx="4" fill="none" stroke="#FF6584" stroke-width="2">
<animate attributeName="y" values="60;55;60" dur="2s" repeatCount="indefinite"/>
</rect>
<text x="140" y="80" text-anchor="middle" fill="#FF6584" font-size="14">📺</text>
<rect x="440" y="50" width="35" height="50" rx="6" fill="none" stroke="#FFD93D" stroke-width="2">
<animate attributeName="y" values="50;45;50" dur="2.5s" repeatCount="indefinite"/>
</rect>
<text x="457" y="80" text-anchor="middle" fill="#FFD93D" font-size="14">📱</text>
<circle cx="160" cy="180" r="20" fill="none" stroke="#00D2FF" stroke-width="2">
<animate attributeName="r" values="20;23;20" dur="2s" repeatCount="indefinite"/>
</circle>
<text x="160" y="186" text-anchor="middle" fill="#00D2FF" font-size="14">📰</text>
<circle cx="440" cy="170" r="20" fill="none" stroke="#6C63FF" stroke-width="2">
<animate attributeName="r" values="20;23;20" dur="1.8s" repeatCount="indefinite"/>
</circle>
<text x="440" y="176" text-anchor="middle" fill="#6C63FF" font-size="14">🎧</text>
</svg>
<div class="hero-btns">
<button class="btn btn-primary btn-lg" onclick="showSection('lessons')">🚀 شروع یادگیری</button>
<button class="btn btn-secondary btn-lg" onclick="showSection('quiz')">📝 آزمون بده</button>
<button class="btn btn-accent btn-lg" onclick="showSection('games')">🎮 بازی و تمرین</button>
</div>
</div>
</div>
<div class="daily-challenge-card" id="dailyChallengeCard">
<div class="challenge-header">
<span class="challenge-icon">🎯</span>
<div>
<h3>چالش روزانه</h3>
<p id="dailyChallengeDesc">در حال بارگذاری...</p>
</div>
<button class="btn btn-primary btn-sm" onclick="startDailyChallenge()">شروع</button>
</div>
<div class="challenge-progress">
<div class="challenge-progress-bar" id="dailyChallengeProgress" style="width:0%"></div>
</div>
</div>
<h2 style="margin:30px 0 20px; font-size:1.5em;">📖 درسهای کتاب</h2>
<div class="cards-grid" id="lessonCards"></div>
<h2 style="margin:30px 0 20px; font-size:1.5em;">📊 آمار یادگیری شما</h2>
<div class="cards-grid">
<div class="card" style="text-align:center">
<div class="card-icon">📚</div>
<h3 id="statLessons">0/5</h3>
<p>درس مطالعه شده</p>
</div>
<div class="card" style="text-align:center">
<div class="card-icon">✅</div>
<h3 id="statCorrect">0</h3>
<p>پاسخ صحیح</p>
</div>
<div class="card" style="text-align:center">
<div class="card-icon">🎯</div>
<h3 id="statAccuracy">0%</h3>
<p>دقت پاسخها</p>
</div>
<div class="card" style="text-align:center">
<div class="card-icon">🏆</div>
<h3 id="statAchievements">0</h3>
<p>دستاوردها</p>
</div>
</div>
<h2 style="margin:30px 0 20px; font-size:1.5em;">🕐 فعالیتهای اخیر</h2>
<div id="recentActivity" class="activity-list"></div>
</div>
<div class="section" id="sec-lessons">
<div id="lessonList">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; flex-wrap:wrap; gap:12px;">
<h2>📚 انتخاب درس</h2>
<div class="search-box">
<input type="text" id="lessonSearch" placeholder="🔍 جستجو در درسها..." oninput="filterLessons()">
</div>
</div>
<div class="cards-grid" id="lessonCardsGrid"></div>
</div>
<div id="lessonDetail" style="display:none"></div>
</div>
<div class="section" id="sec-quiz">
<div id="quizSetup">
<h2 style="margin-bottom:20px;">📝 آزمون هوشمند</h2>
<div class="lesson-content">
<h3>🎯 نوع آزمون را انتخاب کنید</h3>
<div class="cards-grid" style="margin-top:20px;">
<div class="card" onclick="startQuiz('all')" style="text-align:center">
<div class="card-icon">📋</div>
<h3>آزمون جامع</h3>
<p>۱۰۰ سوال از تمام درسها</p>
<button class="btn btn-primary" style="margin-top:12px">شروع</button>
</div>
<div class="card" onclick="startQuiz('timed')" style="text-align:center">
<div class="card-icon">⏱️</div>
<h3>آزمون زماندار</h3>
<p>۲۰ سوال در ۱۰ دقیقه</p>
<button class="btn btn-accent" style="margin-top:12px">شروع</button>
</div>
<div class="card" onclick="startQuiz('adaptive')" style="text-align:center">
<div class="card-icon">🎯</div>
<h3>آزمون تطبیقی</h3>
<p>بر اساس نقاط ضعفتان</p>
<button class="btn btn-secondary" style="margin-top:12px">شروع</button>
</div>
<div class="card" onclick="startQuiz('weak')" style="text-align:center">
<div class="card-icon">💪</div>
<h3>تقویت نقاط ضعف</h3>
<p>سوالاتی که اشتباه جواب دادی</p>
<button class="btn btn-secondary" style="margin-top:12px">شروع</button>
</div>
</div>
<h3 style="margin-top:30px;">📖 آزمون بر اساس درس</h3>
<div class="cards-grid" style="margin-top:20px;">
<div class="card" onclick="startQuiz('lesson1')" style="text-align:center">
<div class="card-icon">📺</div>
<h3>درس ۱</h3>
<p>مفهوم رسانه</p>
<button class="btn btn-secondary" style="margin-top:12px">شروع</button>
</div>
<div class="card" onclick="startQuiz('lesson2')" style="text-align:center">
<div class="card-icon">🔍</div>
<h3>درس ۲</h3>
<p>سواد رسانهای</p>
<button class="btn btn-secondary" style="margin-top:12px">شروع</button>
</div>
<div class="card" onclick="startQuiz('lesson3')" style="text-align:center">
<div class="card-icon">🪞</div>
<h3>درس ۳</h3>
<p>بازنمایی</p>
<button class="btn btn-secondary" style="margin-top:12px">شروع</button>
</div>
<div class="card" onclick="startQuiz('lesson4')" style="text-align:center">
<div class="card-icon">💰</div>
<h3>درس ۴</h3>
<p>اقتصاد سیاسی</p>
<button class="btn btn-secondary" style="margin-top:12px">شروع</button>
</div>
<div class="card" onclick="startQuiz('lesson5')" style="text-align:center">
<div class="card-icon">👥</div>
<h3>درس ۵</h3>
<p>مخاطبشناسی</p>
<button class="btn btn-secondary" style="margin-top:12px">شروع</button>
</div>
</div>
</div>
</div>
<div id="quizArea" style="display:none"></div>
<div id="quizResults" style="display:none"></div>
</div>
<div class="section" id="sec-games">
<h2 style="margin-bottom:20px;">🎮 بازیهای آموزشی</h2>
<div class="cards-grid">
<div class="card" onclick="startGame('flashcards')" style="text-align:center">
<div class="card-icon">🃏</div>
<h3>فلشکارت</h3>
<p>مرور مفاهیم کلیدی</p>
</div>
<div class="card" onclick="startGame('matching')" style="text-align:center">
<div class="card-icon">🔗</div>
<h3>بازی تطبیق</h3>
<p>مفاهیم را جفت کنید</p>
</div>
<div class="card" onclick="startGame('mindmap')" style="text-align:center">
<div class="card-icon">🧩</div>
<h3>نقشه ذهنی</h3>
<p>ارتباط مفاهیم</p>
</div>
<div class="card" onclick="startGame('ordering')" style="text-align:center">
<div class="card-icon">📊</div>
<h3>مرتبسازی</h3>
<p>مراحل را مرتب کنید</p>
</div>
<div class="card" onclick="startGame('truefalse')" style="text-align:center">
<div class="card-icon">⚡</div>
<h3>درست یا غلط</h3>
<p>سرعت عمل</p>
</div>
<div class="card" onclick="startGame('fillblank')" style="text-align:center">
<div class="card-icon">✏️</div>
<h3>جای خالی</h3>
<p>کلمات کلیدی</p>
</div>
<div class="card" onclick="startGame('memory')" style="text-align:center">
<div class="card-icon">🧠</div>
<h3>بازی حافظه</h3>
<p>جفتها را پیدا کنید</p>
</div>
<div class="card" onclick="startGame('speed')" style="text-align:center">
<div class="card-icon">⚡</div>
<h3>بازی سرعت</h3>
<p>پاسخ سریع</p>
</div>
<div class="card" onclick="startGame('word')" style="text-align:center">
<div class="card-icon">🔤</div>
<h3>بازی کلمات</h3>
<p>حدس کلمه</p>
</div>
</div>
<div id="gameArea" style="margin-top:20px;"></div>
</div>
<div class="section" id="sec-review">
<h2 style="margin-bottom:20px;">📊 مرور و آمار</h2>
<div class="tabs">
<button class="tab active" onclick="showReviewTab('progress', event)">پیشرفت</button>
<button class="tab" onclick="showReviewTab('weaknesses', event)">نقاط ضعف</button>
<button class="tab" onclick="showReviewTab('achievements', event)">دستاوردها</button>
<button class="tab" onclick="showReviewTab('analytics', event)">تحلیل</button>
<button class="tab" onclick="showReviewTab('bookmarks', event)">بوکمارکها</button>
<button class="tab" onclick="showReviewTab('notes', event)">یادداشتها</button>
<button class="tab" onclick="showReviewTab('formulas', event)">فرمولها</button>
</div>
<div id="reviewContent"></div>
</div>
<div class="section" id="sec-profile">
<h2 style="margin-bottom:20px;">👤 پروفایل شما</h2>
<div id="profileContent"></div>
</div>
</div>
<div class="mobile-nav">
<button class="mobile-nav-item active" data-section="home">
<span class="m-icon">🏠</span>خانه
</button>
<button class="mobile-nav-item" data-section="lessons">
<span class="m-icon">📚</span>درسها
</button>
<button class="mobile-nav-item" data-section="quiz">
<span class="m-icon">📝</span>آزمون
</button>
<button class="mobile-nav-item" data-section="games">
<span class="m-icon">🎮</span>بازی
</button>
<button class="mobile-nav-item" data-section="profile">
<span class="m-icon">👤</span>پروفایل
</button>
</div>
<div class="ai-chat">
<div class="ai-panel" id="aiPanel">
<div class="ai-panel-header">
<span style="font-size:1.5em">🤖</span>
<div style="flex:1">
<h4>دستیار هوشمند</h4>
<small style="color:var(--text-dim)">هر سوالی داری بپرس!</small>
</div>
<button class="ai-close" onclick="toggleAi()">✕</button>
</div>
<div class="ai-messages" id="aiMessages">
<div class="ai-msg bot">
<div class="msg-bubble">سلام! 👋 من دستیار هوشمند تفکر و رسانه هستم. هر سوالی درباره درسها داری بپرس!</div>
</div>
</div>
<div class="ai-suggestions">
<button class="ai-suggestion" onclick="askAi('رسانه چیست؟')">رسانه چیست؟</button>
<button class="ai-suggestion" onclick="askAi('سواد رسانهای')">سواد رسانهای</button>
<button class="ai-suggestion" onclick="askAi('بازنمایی')">بازنمایی</button>
<button class="ai-suggestion" onclick="askAi('امتحان')">آمادگی امتحان</button>
</div>
<div class="ai-input-area">
<input type="text" id="aiInput" placeholder="سوالت رو بنویس..." onkeypress="if(event.key==='Enter')sendAiMsg()">
<button onclick="sendAiMsg()">📤</button>
</div>
</div>
<button class="ai-toggle" onclick="toggleAi()">🤖</button>
</div>
</div>
<div class="modal" id="achievementModal">
<div class="modal-content">
<div class="modal-header">
<h3>🏆 دستاورد جدید!</h3>
<button class="modal-close" onclick="closeModal('achievementModal')">✕</button>
</div>
<div class="modal-body" id="achievementModalBody"></div>
</div>
</div>
<div class="modal" id="levelUpModal">
<div class="modal-content">
<div class="modal-header">
<h3>⭐ سطح بالاتر!</h3>
<button class="modal-close" onclick="closeModal('levelUpModal')">✕</button>
</div>
<div class="modal-body" id="levelUpModalBody"></div>
</div>
</div>
<div id="notifications"></div>
<script>
// ============ DATA ============
const lessonsData = {
lesson1: {
id: 'lesson1', title: 'درس ۱: مفهوم رسانه و انواع آن', icon: '📺',
color: '#6C63FF', progress: 0,
content: `
<h3>🎯 اهداف درس</h3>
<ul><li>درک مفهوم رسانه و اهمیت آن</li><li>آشنایی با انواع رسانه</li><li>تفاوت رسانههای سنتی و نوین</li></ul>
<div class="definition"><strong>تعریف رسانه (Media):</strong> رسانه هر ابزار، کانال یا وسیلهای است که پیامی را از فرستنده به گیرنده منتقل میکند.</div>
<h3>📌 تعاریف مهم</h3>
<div class="key-point"><strong>مارشال مکلوهان:</strong> «رسانه همان پیام است». یعنی خود رسانه تأثیر بیشتری از محتوای آن دارد.</div>
<div class="example">تلویزیون با ذات تصویریاش، جهان را به صورت صحنههای بصری کوتاه نشان میدهد، در حالی که کتاب تفکر خطی و عمیق را تقویت میکند.</div>
<h3>📂 انواع رسانه</h3>
<h4>۱. رسانههای چاپی</h4><ul><li>روزنامه، مجله، کتاب</li><li>ویژگی: خطی، عمیق</li></ul>
<h4>۲. رسانههای شنیداری</h4><ul><li>رادیو، پادکست</li><li>ویژگی: یکحسی، تخیلبرانگیز</li></ul>
<h4>۳. رسانههای دیداری</h4><ul><li>تلویزیون، سینما</li><li>ویژگی: چندحسی، جذاب</li></ul>
<h4>۴. رسانههای دیجیتال</h4><ul><li>اینترنت، شبکههای اجتماعی</li><li>ویژگی: تعاملی، چندرسانهای، فوری</li></ul>
<div class="highlight"><strong>🔑 نکته کلیدی:</strong> رسانهها بر اساس حواس، تعامل، زمان و مخاطب طبقهبندی میشوند.</div>
<h3>🎯 کارکردهای رسانه</h3>
<ol><li><strong>اطلاعرسانی</strong></li><li><strong>آموزش</strong></li><li><strong>سرگرمی</strong></li><li><strong>نظارت اجتماعی</strong></li><li><strong>جامعهپذیری</strong></li><li><strong>همبستگی اجتماعی</strong></li></ol>
`
},
lesson2: {
id: 'lesson2', title: 'درس ۲: سواد رسانهای', icon: '🔍',
color: '#FF6584', progress: 0,
content: `
<h3>🎯 اهداف درس</h3>
<ul><li>درک مفهوم سواد رسانهای</li><li>آشنایی با مؤلفههای سواد رسانهای</li><li>توانایی تحلیل انتقادی</li></ul>
<div class="definition"><strong>سواد رسانهای:</strong> توانایی دسترسی، تحلیل، ارزیابی و خلق پیامهای رسانهای.</div>
<h3>🔑 پنج سؤال کلیدی</h3>
<div class="highlight"><ol>
<li><strong>چه کسی این پیام را ساخته است؟</strong></li>
<li><strong>از چه تکنیکهایی استفاده شده؟</strong></li>
<li><strong>دیگران چگونه ممکن است متفاوت بفهمند؟</strong></li>
<li><strong>چه چیزی ارائه یا حذف شده؟</strong></li>
<li><strong>این پیام چرا ارسال شده است؟</strong></li>
</ol></div>
<h3>🧩 مؤلفههای سواد رسانهای</h3>
<ol><li><strong>آگاهی</strong></li><li><strong>دانش</strong></li><li><strong>مهارت تحلیل</strong></li><li><strong>ارزیابی انتقادی</strong></li><li><strong>خلق پیام</strong></li><li><strong>مشارکت</strong></li></ol>
<h3>🎭 تکنیکهای اقناع</h3>
<ul><li><strong>تکرار</strong></li><li><strong>ترس</strong></li><li><strong>شواهد اجتماعی</strong></li><li><strong>افراد مشهور</strong></li><li><strong>سادگی</strong></li><li><strong>احساسات</strong></li><li><strong>برچسبزنی</strong></li></ul>
<div class="key-point"><strong>⚡ اصل مهم:</strong> سواد رسانهای به معنای مصرف آگاهانه و انتقادی است، نه مخالفت با رسانه.</div>
`
},
lesson3: {
id: 'lesson3', title: 'درس ۳: بازنمایی در رسانه', icon: '🪞',
color: '#00D2FF', progress: 0,
content: `
<h3>🎯 اهداف درس</h3>
<ul><li>درک مفهوم بازنمایی</li><li>شناخت نحوه بازنمایی گروهها</li><li>تحلیل کلیشهها</li></ul>
<div class="definition"><strong>بازنمایی (Representation):</strong> فرایندی که رسانه واقعیت را «بازنمایی» میکند، نه منعکس. رسانه مانند لنز عمل میکند، نه آینه.</div>
<h3>🔧 ابزارهای بازنمایی</h3>
<ul><li><strong>انتخاب</strong></li><li><strong>حذف</strong></li><li><strong>بزرگنمایی</strong></li><li><strong>کاهش</strong></li><li><strong>قاببندی</strong></li><li><strong>ترکیببندی</strong></li></ul>
<h3>🎭 کلیشهها (Stereotypes)</h3>
<div class="definition"><strong>کلیشه:</strong> تصویری سادهشده، ثابت و تعمیمیافته از یک گروه.</div>
<h4>انواع کلیشهها:</h4>
<ul><li><strong>جنسیتی</strong>: زنان احساساتی، مردان منطقی</li><li><strong>قومی</strong></li><li><strong>سنی</strong></li><li><strong>شغلی</strong></li></ul>
<div class="key-point"><strong>⚡ نکته مهم:</strong> بازنمایی مسئلهای قدرتمحور است. هر که قدرت تولید رسانه دارد، قدرت تعریف واقعیت را دارد.</div>
`
},
lesson4: {
id: 'lesson4', title: 'درس ۴: اقتصاد سیاسی رسانه', icon: '💰',
color: '#FFD93D', progress: 0,
content: `
<h3>🎯 اهداف درس</h3>
<ul><li>درک رابطه اقتصاد و رسانه</li><li>شناخت ساختار مالکیت</li><li>تحلیل تأثیر منافع اقتصادی</li></ul>
<div class="definition"><strong>اقتصاد سیاسی رسانه:</strong> رویکردی که رابطه ساختارهای اقتصادی، قدرت سیاسی و تولید محتوا را بررسی میکند.</div>
<h3>💼 ساختار مالکیت</h3>
<h4>۱. رسانههای دولتی</h4><ul><li>مالکیت: دولت</li><li>منبع درآمد: بودجه عمومی</li></ul>
<h4>۲. رسانههای تجاری</h4><ul><li>مالکیت: بخش خصوصی</li><li>منبع درآمد: تبلیغات، اشتراک</li></ul>
<h3>🏢 غولهای رسانهای</h3>
<div class="highlight"><ul>
<li>تعداد کمی شرکت، هزاران رسانه را کنترل میکنند</li>
<li><strong>همافزایی (Synergy):</strong> توزیع محتوا در پلتفرمهای مختلف یک شرکت</li>
<li><strong>عمودی شدن:</strong> کنترل تمام مراحل تولید تا توزیع</li>
</ul></div>
<h3>📺 اقتصاد توجه</h3>
<div class="definition"><strong>اقتصاد توجه:</strong> توجه مخاطب کمیابترین منبع است. توجه = درآمد تبلیغاتی.</div>
<div class="example">شبکههای اجتماعی رایگاناند چون محصول آنها «شما» هستید.</div>
<div class="key-point"><strong>⚡ مدل پروپاگاندای هرمان و چامسکی (۵ فیلتر):</strong>
<ol><li>مالکیت و سودمحوری</li><li>وابستگی به تبلیغات</li><li>اتکا به منابع رسمی</li><li>فشار و انتقاد (Flak)</li><li>ایدئولوژی مشترک</li></ol></div>
`
},
lesson5: {
id: 'lesson5', title: 'درس ۵: مخاطبشناسی رسانه', icon: '👥',
color: '#00C853', progress: 0,
content: `
<h3>🎯 اهداف درس</h3>
<ul><li>درک نقش فعال مخاطب</li><li>آشنایی با نظریههای مخاطبشناسی</li><li>تحلیل دریافت پیام</li></ul>
<div class="definition"><strong>مخاطب:</strong> فرد یا گروهی که پیام را دریافت و تفسیر میکند. مخاطب فعالانه معنا میسازد.</div>
<h3>📜 سیر تحول نگاه به مخاطب</h3>
<h4>۱. مدل تزریقی (مخاطب منفعل)</h4>
<div class="key-point"><strong>گلوله جادویی:</strong> رسانه مانند گلوله به ذهن مخاطب منفعل شلیک میکند.</div>
<h4>۲. مدل استفاده و خشنودی (مخاطب فعال)</h4>
<div class="highlight"><strong>Uses and Gratifications:</strong> مخاطب فعالانه رسانه را انتخاب میکند:
<ul><li>نیاز اطلاعاتی</li><li>نیاز هویتی</li><li>نیاز یکپارچگی اجتماعی</li><li>نیاز سرگرمی</li></ul></div>
<h4>۳. مدل رمزگذاری/رمزگشایی (هال)</h4>
<h4>سه نوع رمزگشایی:</h4>
<ol><li><strong>قرائت غالب</strong>: پذیرش کامل</li><li><strong>قرائت مذاکراتی</strong>: پذیرش نسبی</li><li><strong>قرائت تقابلی</strong>: برداشت مخالف</li></ol>
<h3>🌐 مخاطب در عصر دیجیتال</h3>
<div class="highlight"><ul>
<li><strong>Produser:</strong> تولید-مصرفکننده</li>
<li><strong>User Generated Content</strong></li>
<li><strong>فرهنگ مشارکتی</strong></li>
</ul></div>
<h3>📊 اثرات رسانه</h3>
<ul><li><strong>کاشت (Cultivation)</strong></li><li><strong>برجستهسازی (Agenda Setting)</strong>: رسانه میگوید «درباره چه فکر کنیم»</li><li><strong>یادگیری اجتماعی</strong></li><li><strong>مارپیچ سکوت</strong></li></ul>
<div class="key-point"><strong>⚡ نتیجه:</strong> مخاطب در چارچوبهای فرهنگی خود فعالانه معنا میسازد.</div>
`
}
};
// ============ 100 QUIZ QUESTIONS (ALL FIXED) ============
const allQuestions = [
{id:1, lesson:'lesson1', type:'multiple', q:'کدام عبارت بهترین تعریف از «رسانه» است؟', opts:['ابزاری برای سرگرمی','هر وسیلهای که پیامی را از فرستنده به گیرنده منتقل کند','فقط تلویزیون و اینترنت','وسیلهای برای آموزش'], correct:1, explain:'رسانه هر ابزار، کانال یا وسیلهای است که پیام منتقل میکند.'},
{id:2, lesson:'lesson1', type:'multiple', q:'«رسانه همان پیام است» جملهای از کیست؟', opts:['نوام چامسکی','استوارت هال','مارشال مکلوهان','والتر لیپمن'], correct:2, explain:'مارشال مکلوهان این جمله مشهور را بیان کرد.'},
{id:3, lesson:'lesson1', type:'multiple', q:'منظور مکلوهان از «رسانه همان پیام است» چیست؟', opts:['محتوای رسانه مهم نیست','خود رسانه تأثیر بیشتری از محتوای آن دارد','فقط رسانههای تصویری مهماند','پیامها باید کوتاه باشند'], correct:1, explain:'ویژگیهای ذاتی رسانه، نحوه درک ما را شکل میدهد.'},
{id:4, lesson:'lesson1', type:'multiple', q:'کدام مورد از ویژگیهای رسانههای نوین است؟', opts:['یکسویه بودن','سرعت پایین','تعاملی بودن','دسترسی محدود'], correct:2, explain:'رسانههای نوین تعاملی، سریع و با دسترسی جهانیاند.'},
{id:5, lesson:'lesson1', type:'multiple', q:'رادیو جزو کدام دسته از رسانههاست؟', opts:['دیداری','شنیداری','چاپی','تعاملی'], correct:1, explain:'رادیو رسانهای شنیداری است.'},
{id:6, lesson:'lesson1', type:'multiple', q:'کدام مورد جزو کارکردهای رسانه نیست؟', opts:['اطلاعرسانی','سرگرمی','تخریب فرهنگی','جامعهپذیری'], correct:2, explain:'تخریب فرهنگی جزو کارکردهای رسانه نیست.'},
{id:7, lesson:'lesson1', type:'multiple', q:'رسانههای سنتی نسبت به نوین چه ویژگیای دارند؟', opts:['تعامل بیشتر','سرعت بالاتر','یکسویه بودن','دسترسی جهانی'], correct:2, explain:'رسانههای سنتی معمولاً یکسویهاند.'},
{id:8, lesson:'lesson1', type:'multiple', q:'کدام معیار برای طبقهبندی رسانهها نیست؟', opts:['بر اساس حواس','بر اساس تعامل','بر اساس رنگ','بر اساس زمان'], correct:2, explain:'رنگ معیار طبقهبندی رسانهها نیست.'},
{id:9, lesson:'lesson1', type:'multiple', q:'اینترنت چه نوع رسانهای است؟', opts:['یکسویه و همزمان','دوسویه و غیرهمزمان','تعاملی و چندرسانهای','فقط دیداری'], correct:2, explain:'اینترنت تعاملی، چندرسانهای و ترکیبی است.'},
{id:10, lesson:'lesson1', type:'multiple', q:'کارکرد «نظارت اجتماعی» یعنی:', opts:['کنترل سیاسی مردم','رصد و گزارش رفتارها و رویدادها','جاسوسی از شهروندان','سانسور اخبار'], correct:1, explain:'نظارت اجتماعی یعنی رصد و گزارش رویدادها.'},
{id:11, lesson:'lesson1', type:'truefalse', q:'رسانه فقط شامل تلویزیون و اینترنت میشود.', correct:false, explain:'رسانه هر وسیلهای است که پیام منتقل کند.'},
{id:12, lesson:'lesson1', type:'truefalse', q:'مکلوهان معتقد بود ویژگیهای ذاتی رسانه از محتوا مهمتر است.', correct:true, explain:'بله، این هسته اصلی نظریه اوست.'},
{id:13, lesson:'lesson1', type:'fillblank', q:'رسانه هر ______ یا وسیلهای است که پیامی را منتقل کند.', correct:['ابزار','کانال'], explain:'رسانه هر ابزار، کانال یا وسیلهای است.'},
{id:14, lesson:'lesson1', type:'multiple', q:'کدام مورد جزو رسانههای چاپی نیست؟', opts:['روزنامه','مجله','پادکست','کتاب'], correct:2, explain:'پادکست رسانه شنیداری دیجیتال است.'},
{id:15, lesson:'lesson1', type:'multiple', q:'همافزایی رسانهای یعنی:', opts:['رقابت رسانهها','توزیع محتوا در پلتفرمهای مختلف یک شرکت','حذف رسانههای ضعیف','افزایش تعداد رسانهها'], correct:1, explain:'همافزایی یعنی توزیع محتوا در پلتفرمهای یک شرکت.'},
{id:16, lesson:'lesson1', type:'ordering', q:'ترتیب ظهور رسانهها:', items:['رسانههای شفاهی','رسانههای چاپی','رسانههای شنیداری','رسانههای دیداری','رسانههای دیجیتال'], correct:[0,1,2,3,4], explain:'ترتیب تاریخی ظهور رسانهها.'},
{id:17, lesson:'lesson1', type:'multiple', q:'کدام ویژگی مختص رسانههای دیجیتال است؟', opts:['خطی بودن','تکحسی','تعاملی بودن','ثابت بودن'], correct:2, explain:'تعاملی بودن ویژگی کلیدی رسانههای دیجیتال است.'},
{id:18, lesson:'lesson1', type:'multiple', q:'جامعهپذیری یعنی:', opts:['ایجاد شغل','انتقال ارزشها و هنجارها به نسل جدید','فروش محصولات','تولید خبر'], correct:1, explain:'جامعهپذیری یعنی انتقال ارزشها و هنجارها.'},
{id:19, lesson:'lesson1', type:'truefalse', q:'مخاطب تلویزیون معمولاً فعالتر از مخاطب اینترنت است.', correct:false, explain:'خیر، مخاطب اینترنت فعالتر است.'},
{id:20, lesson:'lesson1', type:'multiple', q:'کدام مورد از مزایای رسانههای نوین نیست؟', opts:['تعامل بالا','سرعت انتشار','عمیقتر شدن تفکر','دسترسی جهانی'], correct:2, explain:'عمیقتر شدن تفکر از مزایای رسانههای چاپی است.'},
{id:21, lesson:'lesson2', type:'multiple', q:'سواد رسانهای یعنی:', opts:['توانایی خواندن روزنامه','توانایی دسترسی، تحلیل، ارزیابی و خلق پیامهای رسانهای','توانایی ساخت وبسایت','سواد کامپیوتری'], correct:1, explain:'سواد رسانهای شامل دسترسی، تحلیل، ارزیابی و خلق پیام است.'},
{id:22, lesson:'lesson2', type:'multiple', q:'اولین سؤال کلیدی سواد رسانهای چیست؟', opts:['این پیام چگونه ساخته شده؟','چه کسی این پیام را ساخته است؟','این پیام چه تأثیری دارد؟','این پیام کی منتشر شده؟'], correct:1, explain:'اولین سؤال: چه کسی این پیام را ساخته است؟'},
{id:23, lesson:'lesson2', type:'multiple', q:'کدام مورد از مؤلفههای سواد رسانهای نیست؟', opts:['آگاهی','تحلیل','بیتفاوتی','خلق پیام'], correct:2, explain:'بیتفاوتی مؤلفه سواد رسانهای نیست.'},
{id:24, lesson:'lesson2', type:'multiple', q:'تکنیک «شواهد اجتماعی» یعنی:', opts:['استفاده از آمار علمی','القای اینکه «همه دارند این کار را میکنند»','ارائه مدارک','نقل قول از متخصصان'], correct:1, explain:'شواهد اجتماعی یعنی القای حس اکثریت.'},
{id:25, lesson:'lesson2', type:'multiple', q:'سواد رسانهای به معنای چیست؟', opts:['مخالفت با همه رسانهها','قطع کامل استفاده','مصرف آگاهانه و انتقادی','فقط استفاده از کتاب'], correct:2, explain:'سواد رسانهای یعنی مصرف آگاهانه و انتقادی.'},
{id:26, lesson:'lesson2', type:'multiple', q:'تکنیک «ترس» چگونه عمل میکند؟', opts:['با ایجاد حس شادی','با ایجاد ترس برای ترغیب به عمل','با ارائه اطلاعات علمی','با استفاده از طنز'], correct:1, explain:'تکنیک ترس با ایجاد ترس، مخاطب را ترغیب میکند.'},
{id:27, lesson:'lesson2', type:'truefalse', q:'سواد رسانهای فقط برای کودکان ضروری است.', correct:false, explain:'سواد رسانهای برای همه سنین ضروری است.'},
{id:28, lesson:'lesson2', type:'multiple', q:'پنجمین سؤال کلیدی سواد رسانهای درباره چیست؟', opts:['فرستنده پیام','تکنیکهای ساخت','هدف ارسال پیام','مخاطبان مختلف'], correct:2, explain:'پنجمین سؤال: این پیام چرا ارسال شده؟ (هدف).'},
{id:29, lesson:'lesson2', type:'multiple', q:'«برچسبزنی» یعنی:', opts:['قیمتگذاری','نسبت دادن صفات مثبت یا منفی به افراد','نصب برچسب فیزیکی','تبلیغ محصول'], correct:1, explain:'برچسبزنی یعنی نسبت دادن صفات خاص.'},
{id:30, lesson:'lesson2', type:'multiple', q:'کدام مورد از تکنیکهای اقناع نیست؟', opts:['تکرار','احساسات','تفکر انتقادی','سادگی'], correct:2, explain:'تفکر انتقادی ابزار مقابله با اقناع است.'},
{id:31, lesson:'lesson2', type:'fillblank', q:'سواد رسانهای توانایی دسترسی، ______، ارزیابی و خلق پیامهاست.', correct:['تحلیل'], explain:'تحلیل یکی از مؤلفههای اصلی است.'},
{id:32, lesson:'lesson2', type:'multiple', q:'فرد با سواد رسانهای وقتی تبلیغی میبیند:', opts:['فوراً خرید میکند','سؤالات انتقادی مطرح میکند','تلویزیون را خاموش میکند','تبلیغ را نادیده میگیرد'], correct:1, explain:'فرد با سواد رسانهای، سؤالات انتقادی مطرح میکند.'},
{id:33, lesson:'lesson2', type:'truefalse', q:'تکنیک تکرار برای نفوذ پیام در ذهن استفاده میشود.', correct:true, explain:'بله، تکرار مؤثرترین تکنیک اقناع است.'},
{id:34, lesson:'lesson2', type:'multiple', q:'کدام سؤال جزو ۵ سؤال کلیدی نیست؟', opts:['چه کسی ساخته؟','چه تکنیکهایی؟','هزینه تولید چقدر؟','چرا ارسال شده؟'], correct:2, explain:'هزینه تولید جزو ۵ سؤال کلیدی نیست.'},
{id:35, lesson:'lesson2', type:'multiple', q:'مؤلفه «مشارکت» یعنی:', opts:['فقط مصرف رسانه','فعالیت آگاهانه در فضای رسانهای','ساخت رسانه','فقط نقد رسانه'], correct:1, explain:'مشارکت یعنی فعالیت آگاهانه.'},
{id:36, lesson:'lesson2', type:'multiple', q:'استفاده از افراد مشهور کدام تکنیک است؟', opts:['ترس','تکرار','افراد مشهور','شواهد اجتماعی'], correct:2, explain:'تکنیک «افراد مشهور» است.'},
{id:37, lesson:'lesson2', type:'ordering', q:'مراحل تحلیل انتقادی:', items:['شناسایی فرستنده','بررسی تکنیکها','تحلیل تفسیرها','بررسی بازنماییها','تحلیل هدف'], correct:[0,1,2,3,4], explain:'ترتیب منطقی تحلیل.'},
{id:38, lesson:'lesson2', type:'multiple', q:'نشانه بیسوادی رسانهای:', opts:['پرسش درباره منبع','پذیرش بدون انتقاد','مقایسه منابع','تحلیل محتوا'], correct:1, explain:'پذیرش بدون انتقاد نشانه بیسوادی است.'},
{id:39, lesson:'lesson2', type:'truefalse', q:'سواد رسانهای شامل توانایی خلق پیام نیز میشود.', correct:true, explain:'بله، خلق مسئولانه پیام یکی از مؤلفههاست.'},
{id:40, lesson:'lesson2', type:'multiple', q:'تکنیک «سادگی» یعنی:', opts:['استفاده از زبان علمی','ارائه پیامهای ساده و شعارگونه','پیچیده کردن موضوع','استفاده از نمودار'], correct:1, explain:'تکنیک سادگی یعنی ارائه ساده و شعارگونه.'},
{id:41, lesson:'lesson3', type:'multiple', q:'بازنمایی در رسانه یعنی:', opts:['نمایش دقیق واقعیت','ساختن معنا و ارائه واقعیت از زاویهای خاص','عکس گرفتن از واقعیت','کپی کردن واقعیت'], correct:1, explain:'بازنمایی یعنی ساختن معنا از زاویهای خاص.'},
{id:42, lesson:'lesson3', type:'multiple', q:'کدام عبارت درباره بازنمایی صحیح است؟', opts:['رسانه آینه واقعیت است','رسانه مانند لنز عمل میکند','رسانه واقعیت را تغییر نمیدهد','بازنمایی و واقعیت یکیاند'], correct:1, explain:'رسانه مانند لنز عمل میکند.'},
{id:43, lesson:'lesson3', type:'multiple', q:'کلیشه یعنی:', opts:['تصویری پیچیده','تصویری سادهشده، ثابت و تعمیمیافته','تصویر واقعی','عکس واقعی'], correct:1, explain:'کلیشه تصویری سادهشده و تعمیمیافته است.'},
{id:44, lesson:'lesson3', type:'multiple', q:'«حذف» در بازنمایی یعنی:', opts:['بزرگنمایی','نادیده گرفتن بخشی از واقعیت','ترکیب عناصر','تغییر رنگها'], correct:1, explain:'حذف یعنی نادیده گرفتن بخشی از واقعیت.'},
{id:45, lesson:'lesson3', type:'multiple', q:'استوارت هال در کدام زمینه نظریهپرداز است؟', opts:['اقتصاد رسانه','بازنمایی و معنا','تاریخ رسانه','فناوری رسانه'], correct:1, explain:'استوارت هال در بازنمایی و معنا.'},
{id:46, lesson:'lesson3', type:'truefalse', q:'بازنمایی همیشه با واقعیت یکسان است.', correct:false, explain:'خیر، بازنمایی تفسیری از واقعیت است.'},
{id:47, lesson:'lesson3', type:'multiple', q:'کدام مورد از ابزارهای بازنمایی نیست؟', opts:['انتخاب','حذف','قاببندی','سانسور کامل'], correct:3, explain:'سانسور کامل ابزار بازنمایی نیست.'},
{id:48, lesson:'lesson3', type:'multiple', q:'کلیشه جنسیتی رایج:', opts:['زنان و مردان یکساناند','زنان احساساتی، مردان منطقی','هیچ کلیشهای نیست','فقط مردان کلیشه میشوند'], correct:1, explain:'کلیشه جنسیتی رایج: زنان احساساتی، مردان منطقی.'},
{id:49, lesson:'lesson3', type:'multiple', q:'«قاببندی» یعنی:', opts:['استفاده از قاب عکس','انتخاب زاویه دید در ارائه پیام','حذف تمام عناصر','تغییر رنگ تصویر'], correct:1, explain:'قاببندی یعنی انتخاب زاویه دید.'},
{id:50, lesson:'lesson3', type:'multiple', q:'چرا بازنمایی قدرتمحور است؟', opts:['چون هنرمندان قدرتمندند','چون هر که قدرت تولید دارد، قدرت تعریف واقعیت دارد','چون رسانهها گراناند','چون مخاطبان ضعیفاند'], correct:1, explain:'هر که قدرت تولید دارد، قدرت تعریف واقعیت دارد.'},
{id:51, lesson:'lesson3', type:'fillblank', q:'رسانه مانند ______ عمل میکند، نه آینه.', correct:['لنز'], explain:'رسانه لنز است.'},
{id:52, lesson:'lesson3', type:'multiple', q:'کدام سؤال برای تحلیل بازنمایی مناسب است؟', opts:['چه کسی حذف شده؟','هزینه تولید چقدر؟','چند نفر دیدند؟','کی منتشر شد؟'], correct:0, explain:'سؤال اصلی: چه کسی بازنمایی و چه کسی حذف شده؟'},
{id:53, lesson:'lesson3', type:'truefalse', q:'کلیشهها پیچیدگیهای واقعیت را حفظ میکنند.', correct:false, explain:'خیر، کلیشهها پیچیدگیها را حذف میکنند.'},
{id:54, lesson:'lesson3', type:'multiple', q:'«بزرگنمایی» یعنی:', opts:['کوچک نشان دادن','برجسته و پررنگ نشان دادن','حذف عنصر','تغییر عنصر'], correct:1, explain:'بزرگنمایی یعنی برجسته نشان دادن.'},
{id:55, lesson:'lesson3', type:'multiple', q:'کدام مورد از انواع کلیشه نیست؟', opts:['کلیشه جنسیتی','کلیشه قومی','کلیشه علمی','کلیشه سنی'], correct:2, explain:'کلیشه علمی جزو انواع رایج نیست.'},
{id:56, lesson:'lesson3', type:'multiple', q:'وقتی رسانه جمعیت را کم نشان میدهد:', opts:['دروغ گفته','بازنمایی خاصی ارائه داده','واقعیت را نشان داده','هیچ کاری نکرده'], correct:1, explain:'این یک بازنمایی خاص است.'},
{id:57, lesson:'lesson3', type:'ordering', q:'مراحل تحلیل بازنمایی:', items:['شناسایی عناصر موجود','شناسایی عناصر حذفشده','بررسی زاویه دید','تحلیل کلیشهها','بررسی منافع'], correct:[0,1,2,3,4], explain:'ترتیب منطقی تحلیل.'},
{id:58, lesson:'lesson3', type:'multiple', q:'نظریهپرداز مهم بازنمایی:', opts:['مکلوهان','استوارت هال','چامسکی','هرمان'], correct:1, explain:'استوارت هال.'},
{id:59, lesson:'lesson3', type:'truefalse', q:'بازنمایی فقط در تصاویر رخ میدهد.', correct:false, explain:'خیر، در همه اشکال رسانهای رخ میدهد.'},
{id:60, lesson:'lesson3', type:'multiple', q:'بهترین توصیف رابطه بازنمایی و قدرت:', opts:['مستقل است','قدرت تعیین میکند چه چیزی بازنمایی شود','فقط دولتها','فقط هنری است'], correct:1, explain:'قدرت تعیین میکند چه چیزی بازنمایی شود.'},
{id:61, lesson:'lesson4', type:'multiple', q:'اقتصاد سیاسی رسانه چه را بررسی میکند؟', opts:['فقط قیمت','رابطه اقتصاد، قدرت سیاسی و محتوا','فقط تبلیغات','فقط سود'], correct:1, explain:'رابطه اقتصاد، قدرت و محتوا.'},
{id:62, lesson:'lesson4', type:'multiple', q:'منبع درآمد رسانههای تجاری:', opts:['بودجه دولتی','تبلیغات و اشتراک','کمکهای مردمی','فروش تجهیزات'], correct:1, explain:'تبلیغات و اشتراک.'},
{id:63, lesson:'lesson4', type:'multiple', q:'BBC چه نوع رسانهای است؟', opts:['تجاری','دولتی (عمومی)','خصوصی','مستقل کامل'], correct:1, explain:'رسانه عمومی.'},
{id:64, lesson:'lesson4', type:'multiple', q:'«همافزایی» یعنی:', opts:['رقابت','توزیع محتوا در پلتفرمهای یک شرکت','ادغام','حذف رسانههای ضعیف'], correct:1, explain:'توزیع در پلتفرمهای یک شرکت.'},
{id:65, lesson:'lesson4', type:'multiple', q:'«عمودی شدن» یعنی:', opts:['رشد ساختمان','کنترل تمام مراحل تولید تا توزیع','تولید عمیق','کاهش هزینه'], correct:1, explain:'کنترل تمام مراحل.'},
{id:66, lesson:'lesson4', type:'multiple', q:'اقتصاد توجه بر چه اصلی استوار است؟', opts:['توجه فراوان است','توجه کمیابترین منبع است','توجه مهم نیست','فقط پول مهم است'], correct:1, explain:'توجه کمیابترین منبع است.'},
{id:67, lesson:'lesson4', type:'truefalse', q:'شبکههای اجتماعی رایگاناند چون لطف میکنند.', correct:false, explain:'خیر، محصول آنها «شما» هستید.'},
{id:68, lesson:'lesson4', type:'multiple', q:'مدل پروپاگاندای هرمان و چامسکی چند فیلتر دارد؟', opts:['۳','۴','۵','۶'], correct:2, explain:'۵ فیلتر.'},
{id:69, lesson:'lesson4', type:'multiple', q:'اولین فیلتر مدل هرمان و چامسکی:', opts:['تبلیغات','مالکیت و سودمحوری','منابع رسمی','ایدئولوژی'], correct:1, explain:'مالکیت و سودمحوری.'},
{id:70, lesson:'lesson4', type:'multiple', q:'تمرکز مالکیت یعنی:', opts:['تنوع','در دست تعداد کمی شرکت','مالکیت دولتی','مالکیت عمومی'], correct:1, explain:'تعداد کمی شرکت کنترل میکنند.'},
{id:71, lesson:'lesson4', type:'fillblank', q:'در اقتصاد توجه، توجه = ______.', correct:['درآمد','پول','ثروت'], explain:'توجه = درآمد.'},
{id:72, lesson:'lesson4', type:'multiple', q:'«زرد شدن رسانه» یعنی:', opts:['تغییر رنگ','تولید اخبار جنجالی برای جذب مخاطب','استفاده از رنگ زرد','کاهش کیفیت چاپ'], correct:1, explain:'تولید اخبار جنجالی.'},
{id:73, lesson:'lesson4', type:'truefalse', q:'مالک رسانه بر خط تحریریه تأثیر ندارد.', correct:false, explain:'مالک تعیینکننده خط تحریریه است.'},
{id:74, lesson:'lesson4', type:'multiple', q:'کدام از پیامدهای تمرکز مالکیت نیست؟', opts:['کاهش تنوع','همگنسازی','افزایش دموکراسی','حذف صداهای اقلیت'], correct:2, explain:'افزایش دموکراسی نیست، کاهش است.'},
{id:75, lesson:'lesson4', type:'multiple', q:'رسانههای دولتی از چه طریقی تأمین مالی میشوند؟', opts:['تبلیغات','بودجه عمومی','فروش محتوا','اشتراک'], correct:1, explain:'بودجه عمومی.'},
{id:76, lesson:'lesson4', type:'ordering', q:'فیلترهای هرمان و چامسکی:', items:['مالکیت و سود','وابستگی به تبلیغات','منابع رسمی','فشار و انتقاد','ایدئولوژی مشترک'], correct:[0,1,2,3,4], explain:'ترتیب پنج فیلتر.'},
{id:77, lesson:'lesson4', type:'multiple', q:'کدام از تأثیرات اقتصاد بر محتوا نیست؟', opts:['تبلیغاتمحوری','زرد شدن','افزایش کیفیت','همگنسازی'], correct:2, explain:'اقتصاد معمولاً کیفیت را کاهش میدهد.'},
{id:78, lesson:'lesson4', type:'multiple', q:'صداوسیما در ایران چه نوع رسانهای است؟', opts:['تجاری','دولتی','عمومی مستقل','خصوصی'], correct:1, explain:'دولتی.'},
{id:79, lesson:'lesson4', type:'truefalse', q:'در شبکههای اجتماعی، دادههای کاربران محصول است.', correct:true, explain:'بله، به تبلیغدهندگان فروخته میشود.'},
{id:80, lesson:'lesson4', type:'multiple', q:'چهارمین فیلتر هرمان و چامسکی:', opts:['تبلیغات','مالکیت','فشار و انتقاد (Flak)','منابع رسمی'], correct:2, explain:'فشار و انتقاد (Flak).'},
{id:81, lesson:'lesson5', type:'multiple', q:'نظریه «گلوله جادویی» مخاطب را چگونه میبیند؟', opts:['فعال','منفعل','خلاق','منتقد'], correct:1, explain:'مخاطب منفعل.'},
{id:82, lesson:'lesson5', type:'multiple', q:'مدل «استفاده و خشنودی» بر چه تأکید دارد؟', opts:['مخاطب منفعل','مخاطب فعالانه انتخاب میکند','رسانه همهقدرت','محتوا مهم نیست'], correct:1, explain:'فعالانه انتخاب میکند.'},
{id:83, lesson:'lesson5', type:'multiple', q:'استوارت هال چند نوع رمزگشایی معرفی کرد؟', opts:['۲','۳','۴','۵'], correct:1, explain:'۳ نوع.'},
{id:84, lesson:'lesson5', type:'multiple', q:'«قرائت تقابلی» یعنی:', opts:['پذیرش کامل','پذیرش نسبی','برداشت معنای مخالف','عدم درک'], correct:2, explain:'برداشت معنای مخالف.'},
{id:85, lesson:'lesson5', type:'multiple', q:'Produser کیست؟', opts:['فقط تولیدکننده','فقط مصرفکننده','هم تولید و هم مصرف','هیچکدام'], correct:2, explain:'هم تولید و هم مصرف.'},
{id:86, lesson:'lesson5', type:'multiple', q:'نظریه «کاشت» درباره چیست؟', opts:['کشاورزی','تأثیر تماشای طولانی تلویزیون بر جهانبینی','کاشت ایده','آموزش مهارت'], correct:1, explain:'تماشای طولانی تلویزیون جهانبینی را شکل میدهد.'},
{id:87, lesson:'lesson5', type:'multiple', q:'نظریه «برجستهسازی» چه میگوید؟', opts:['چه فکر کنیم','درباره چه فکر کنیم','رسانه بیتأثیر','فقط خبرهای خوب'], correct:1, explain:'درباره چه فکر کنیم.'},
{id:88, lesson:'lesson5', type:'truefalse', q:'در گلوله جادویی، همه یکسان تحت تأثیر قرار میگیرند.', correct:true, explain:'بله.'},
{id:89, lesson:'lesson5', type:'multiple', q:'«مارپیچ سکوت» یعنی:', opts:['سکوت مطلق','خودداری از بیان نظر اقلیت','سکوت رسانهها','حذف صداهای مخالف'], correct:1, explain:'خودداری از بیان نظر اقلیت.'},
{id:90, lesson:'lesson5', type:'multiple', q:'فرهنگ مشارکتی یعنی:', opts:['مخاطبان فقط مصرف','مخاطبان در ساخت معنا مشارکت فعال','فرهنگ حذف شده','فقط متخصصان'], correct:1, explain:'مشارکت فعال در ساخت معنا.'},
{id:91, lesson:'lesson5', type:'fillblank', q:'رسانه نمیگوید چه فکر کنیم، بلکه میگوید درباره چه ______ کنیم.', correct:['فکر'], explain:'نظریه برجستهسازی.'},
{id:92, lesson:'lesson5', type:'multiple', q:'نیازهای مخاطب در استفاده و خشنودی:', opts:['فقط سرگرمی','اطلاعات، هویت، یکپارچگی، سرگرمی','فقط اطلاعات','فقط هویت'], correct:1, explain:'چهار نیاز اصلی.'},
{id:93, lesson:'lesson5', type:'multiple', q:'«رمزگشایی» یعنی:', opts:['ساختن پیام','تفسیر پیام توسط مخاطب','حذف پیام','تکرار پیام'], correct:1, explain:'تفسیر پیام توسط مخاطب.'},
{id:94, lesson:'lesson5', type:'truefalse', q:'قرائت مذاکراتی یعنی پذیرش کامل.', correct:false, explain:'خیر، پذیرش نسبی و مقاومت نسبی.'},
{id:95, lesson:'lesson5', type:'multiple', q:'User Generated Content یعنی:', opts:['محتوای حرفهای','محتوای تولیدی کاربران','محتوای دولتی','محتوای تبلیغاتی'], correct:1, explain:'محتوای تولیدی کاربران.'},
{id:96, lesson:'lesson5', type:'multiple', q:'یادگیری اجتماعی یعنی:', opts:['یادگیری در مدرسه','الگوبرداری رفتارها از رسانه','یادگیری زبان','یادگیری کامپیوتر'], correct:1, explain:'الگوبرداری از رسانه.'},
{id:97, lesson:'lesson5', type:'ordering', q:'سیر تحول نگاه به مخاطب:', items:['مخاطب منفعل','استفاده و خشنودی','رمزگذاری/رمزگشایی','مخاطب مشارکتجو'], correct:[0,1,2,3], explain:'ترتیب تاریخی.'},
{id:98, lesson:'lesson5', type:'multiple', q:'مدل رمزگذاری/رمزگشایی از کیست؟', opts:['مکلوهان','استوارت هال','چامسکی','هرمان'], correct:1, explain:'استوارت هال.'},
{id:99, lesson:'lesson5', type:'multiple', q:'در عصر دیجیتال، مرز تولیدکننده و مصرفکننده:', opts:['پررنگتر','از بین رفته','ثابت','قویتر'], correct:1, explain:'از بین رفته.'},
{id:100, lesson:'lesson5', type:'multiple', q:'نتیجه درس مخاطبشناسی:', opts:['کاملاً منفعل','کاملاً آزاد','در چارچوب فرهنگی فعالانه معنا میسازد','بیتأثیر'], correct:2, explain:'در چارچوب فرهنگی فعالانه معنا میسازد.'}
];
const flashcardsData = [
{front:'تعریف رسانه', back:'هر ابزار، کانال یا وسیلهای که پیام منتقل کند.'},
{front:'«رسانه همان پیام است»', back:'مکلوهان: ویژگیهای ذاتی رسانه مهمتر از محتواست.'},
{front:'سواد رسانهای', back:'توانایی دسترسی، تحلیل، ارزیابی و خلق پیام.'},
{front:'۵ سؤال کلیدی', back:'۱.چه کسی ساخته؟ ۲.چه تکنیکهایی؟ ۳.تفسیرهای مختلف؟ ۴.چه حذف شده؟ ۵.چرا ارسال شده؟'},
{front:'بازنمایی', back:'ساختن معنا از واقعیت. رسانه لنز است، نه آینه.'},
{front:'کلیشه', back:'تصویر سادهشده، ثابت و تعمیمیافته از یک گروه.'},
{front:'اقتصاد سیاسی', back:'رابطه اقتصاد، قدرت و محتوا.'},
{front:'همافزایی', back:'توزیع محتوا در پلتفرمهای یک شرکت.'},
{front:'اقتصاد توجه', back:'توجه کمیابترین منبع است. توجه = درآمد.'},
{front:'مدل ۵ فیلتر', back:'مالکیت، تبلیغات، منابع رسمی، فشار، ایدئولوژی.'},
{front:'گلوله جادویی', back:'مخاطب منفعل. رسانه مانند گلوله.'},
{front:'استفاده و خشنودی', back:'مخاطب فعالانه انتخاب میکند.'},
{front:'رمزگذاری/رمزگشایی', back:'هال: سه قرائت - غالب، مذاکراتی، تقابلی.'},
{front:'برجستهسازی', back:'رسانه میگوید درباره چه فکر کنیم.'},
{front:'کاشت', back:'تماشای طولانی تلویزیون جهانبینی را شکل میدهد.'},
{front:'مارپیچ سکوت', back:'خودداری از بیان نظر اقلیت.'},
{front:'Produser', back:'تولید-مصرفکننده.'},
{front:'عمودی شدن', back:'کنترل تمام مراحل تولید تا توزیع.'},
{front:'ابزارهای بازنمایی', back:'انتخاب، حذف، بزرگنمایی، کاهش، قاببندی، ترکیب.'},
{front:'کارکردهای رسانه', back:'اطلاعرسانی، آموزش، سرگرمی، نظارت، جامعهپذیری، همبستگی.'}
];
const matchingData = [
{term:'مکلوهان', def:'رسانه همان پیام است'},
{term:'سواد رسانهای', def:'تحلیل انتقادی پیامها'},
{term:'بازنمایی', def:'ساختن معنا از واقعیت'},
{term:'کلیشه', def:'تصویر سادهشده و تعمیمیافته'},
{term:'هرمان و چامسکی', def:'مدل ۵ فیلتر پروپاگاندا'},
{term:'استوارت هال', def:'رمزگذاری/رمزگشایی'},
{term:'گلوله جادویی', def:'مخاطب منفعل'},
{term:'اقتصاد توجه', def:'توجه = درآمد'},
{term:'برجستهسازی', def:'درباره چه فکر کنیم'},
{term:'Produser', def:'تولید-مصرفکننده'},
{term:'همافزایی', def:'توزیع در پلتفرمهای یک شرکت'},
{term:'مارپیچ سکوت', def:'خودداری از بیان نظر اقلیت'}
];
// ============ STATE ============
let state = {
currentSection: 'home',
currentLesson: null,
totalScore: 0,
xp: 0,
level: 1,
coins: 0,
streak: 0,
maxStreak: 0,
lastActiveDate: null,
correctAnswers: 0,
totalAnswered: 0,
lessonsCompleted: [],
achievements: [],
bookmarks: [],
notes: [],
activities: [],
quizState: null,
weakTopics: {},
dailyChallenge: null,
dailyChallengeCompleted: false,
theme: 'dark',
fontSize: 16,
userName: 'کاربر',
avatar: '🧠',
gamesPlayed: []
};
const saved = localStorage.getItem('mediaLit_state_v2');
if(saved) {
try {
const s = JSON.parse(saved);
state = {...state, ...s};
if(!Array.isArray(state.lessonsCompleted)) state.lessonsCompleted = [];
if(!Array.isArray(state.achievements)) state.achievements = [];
if(!Array.isArray(state.bookmarks)) state.bookmarks = [];
if(!Array.isArray(state.notes)) state.notes = [];
if(!Array.isArray(state.activities)) state.activities = [];
if(!Array.isArray(state.gamesPlayed)) state.gamesPlayed = [];
state.lessonsCompleted = new Set(state.lessonsCompleted);
} catch(e){ state.lessonsCompleted = new Set(); }
} else {
state.lessonsCompleted = new Set();
}
checkDailyStreak();
function saveState() {
const s = {...state, lessonsCompleted: [...state.lessonsCompleted]};
localStorage.setItem('mediaLit_state_v2', JSON.stringify(s));
}
// ============ INIT ============
function init() {
createParticles();
renderLessonCards();
updateStats();
updateProfile();
initDailyChallenge();
setupEventListeners();
applyTheme();
applyFontSize();
updateRecentActivity();
}
function setupEventListeners() {
document.querySelectorAll('.nav-link').forEach(link => {
link.addEventListener('click', () => showSection(link.dataset.section));
});
document.querySelectorAll('.mobile-nav-item').forEach(link => {
link.addEventListener('click', () => showSection(link.dataset.section));
});
document.addEventListener('keydown', (e) => {
if(e.ctrlKey || e.metaKey) {
const map = {'1':'home','2':'lessons','3':'quiz','4':'games','5':'profile'};
if(map[e.key]) { e.preventDefault(); showSection(map[e.key]); }
}
});
}
function createParticles() {
const c = document.getElementById('particles');
for(let i=0; i<30; i++) {
const p = document.createElement('div');
p.className = 'particle';
p.style.left = Math.random()*100 + '%';
p.style.animationDuration = (8 + Math.random()*12) + 's';
p.style.animationDelay = Math.random()*10 + 's';
p.style.width = p.style.height = (2+Math.random()*4) + 'px';
const colors = ['var(--primary)','var(--accent)','var(--secondary)','var(--accent2)'];
p.style.background = colors[Math.floor(Math.random()*colors.length)];
c.appendChild(p);
}
}
function renderLessonCards() {
const grid1 = document.getElementById('lessonCards');
const grid2 = document.getElementById('lessonCardsGrid');
let html = '';
Object.values(lessonsData).forEach(l => {
const done = state.lessonsCompleted.has(l.id);
html += `<div class="card" onclick="openLesson('${l.id}')">
<div class="card-badge" style="background:${l.color}20; color:${l.color}">${done ? '✅ مطالعه شده' : '📖 مطالعه نشده'}</div>
<div class="card-icon">${l.icon}</div>
<h3>${l.title}</h3>
<p>برای مطالعه و یادگیری تعاملی کلیک کنید</p>
<div class="card-progress">
<div class="card-progress-bar">
<div class="card-progress-fill" style="width:${l.progress}%; background:${l.color}"></div>
</div>
</div>
</div>`;
});
if(grid1) grid1.innerHTML = html;
if(grid2) grid2.innerHTML = html;
}
function filterLessons() {
const query = document.getElementById('lessonSearch').value.toLowerCase();
document.querySelectorAll('#lessonCardsGrid .card').forEach(card => {
card.style.display = card.textContent.toLowerCase().includes(query) ? '' : 'none';
});
}
// ============ NAVIGATION ============
function showSection(name) {
state.currentSection = name;
document.querySelectorAll('.section').forEach(s => s.classList.remove('active'));
const sec = document.getElementById('sec-'+name);
if(sec) sec.classList.add('active');
document.querySelectorAll('.nav-link').forEach(l => l.classList.toggle('active', l.dataset.section === name));
document.querySelectorAll('.mobile-nav-item').forEach(l => l.classList.toggle('active', l.dataset.section === name));
if(name === 'profile') updateProfile();
if(name === 'review') showReviewTab('progress');
window.scrollTo({top:0, behavior:'smooth'});
playSound('click');
}
// ============ DAILY STREAK ============
function checkDailyStreak() {
const today = new Date().toDateString();
if(state.lastActiveDate && state.lastActiveDate !== today) {
const last = new Date(state.lastActiveDate);
const diff = Math.floor((new Date(today) - last) / (1000 * 60 * 60 * 24));
if(diff > 1) {
state.streak = 0;
} else {
state.streak++;
state.coins += 5;
}
} else if(!state.lastActiveDate) {
state.streak = 1;
state.coins += 5;
}
state.maxStreak = Math.max(state.maxStreak, state.streak);
state.lastActiveDate = today;
saveState();
}
// ============ DAILY CHALLENGE ============
function initDailyChallenge() {
const today = new Date().toDateString();
if(!state.dailyChallenge || state.dailyChallenge.date !== today) {
const challenges = [
{desc: '۵ سوال از درس ۱ رو درست جواب بده', target: 5, lesson: 'lesson1', type: 'correct'},
{desc: '۳ فلشکارت رو مرور کن', target: 3, type: 'flashcards'},
{desc: '۱۰ سوال درست جواب بده', target: 10, type: 'correct'},
{desc: '۱ درس جدید رو مطالعه کن', target: 1, type: 'lesson'},
{desc: '۲۰ سکه جمع کن', target: 20, type: 'coins'}
];
state.dailyChallenge = {
date: today,
...challenges[Math.floor(Math.random() * challenges.length)],
progress: 0
};
state.dailyChallengeCompleted = false;
saveState();
}
updateDailyChallengeUI();
}
function updateDailyChallengeUI() {
const desc = document.getElementById('dailyChallengeDesc');
const progress = document.getElementById('dailyChallengeProgress');
if(desc && state.dailyChallenge) desc.textContent = state.dailyChallenge.desc;
if(progress && state.dailyChallenge) {
const pct = Math.min((state.dailyChallenge.progress / state.dailyChallenge.target) * 100, 100);
progress.style.width = pct + '%';
}
}
function startDailyChallenge() {
const ch = state.dailyChallenge;
if(!ch) return;
if(ch.lesson) startQuiz(ch.lesson);
else if(ch.type === 'flashcards') { showSection('games'); setTimeout(() => startGame('flashcards'), 100); }
else startQuiz('all');
}
function updateDailyChallenge(type, value) {
const ch = state.dailyChallenge;
if(!ch || state.dailyChallengeCompleted) return;
if(ch.type === type || (ch.lesson && type === 'lesson' && value === ch.lesson)) {
ch.progress += value;
if(ch.progress >= ch.target && !state.dailyChallengeCompleted) {
state.dailyChallengeCompleted = true;
state.coins += 20;
addXP(50);
showNotification('🎯 چالش روزانه تکمیل شد! +۲۰ سکه +۵۰ XP', 'success');
createConfetti();
}
updateDailyChallengeUI();
saveState();
}
}
// ============ LEVEL SYSTEM ============
function addXP(amount) {
state.xp += amount;
showXPPopup('+' + amount + ' XP');
checkLevelUp();
saveState();
updateStats();
}
function checkLevelUp() {
const xpNeeded = state.level * 100;
if(state.xp >= xpNeeded) {
state.xp -= xpNeeded;
state.level++;
state.coins += 50;
showLevelUpModal();
playSound('success');
createConfetti();
}
}
function showXPPopup(text) {
const popup = document.createElement('div');
popup.className = 'xp-popup';
popup.textContent = text;
document.body.appendChild(popup);
setTimeout(() => popup.remove(), 1500);
}
function showLevelUpModal() {
const modal = document.getElementById('levelUpModal');
const body = document.getElementById('levelUpModalBody');
body.innerHTML = `<div style="text-align:center; padding:20px;">
<div style="font-size:4em; margin-bottom:16px;">⭐</div>
<h2 style="color:var(--accent2); margin-bottom:12px;">تبریک! سطح ${state.level}</h2>
<p style="color:var(--text-dim); margin-bottom:20px;">+۵۰ سکه جایزه</p>
<button class="btn btn-primary" onclick="closeModal('levelUpModal')">عالیه!</button>
</div>`;
modal.classList.add('open');
}
function closeModal(id) {
document.getElementById(id).classList.remove('open');
}
// ============ LESSONS ============
function openLesson(id) {
state.currentLesson = id;
const lesson = lessonsData[id];
document.getElementById('lessonList').style.display = 'none';
const detail = document.getElementById('lessonDetail');
detail.style.display = 'block';
const isBookmarked = state.bookmarks.includes(id);
detail.innerHTML = `
<div class="lesson-header">
<div class="lesson-icon">${lesson.icon}</div>
<div style="flex:1; min-width:200px;">
<h2>${lesson.title}</h2>
<div class="lesson-meta">📖 مطالعه تعاملی • ⏱ حدود ۱۵ دقیقه</div>
</div>
<button class="btn btn-secondary btn-sm" onclick="bookmarkLesson('${id}')" title="بوکمارک">${isBookmarked ? '🔖' : '📑'}</button>
<button class="btn btn-secondary btn-sm" onclick="closeLesson()">← بازگشت</button>
</div>
<div class="lesson-content">${lesson.content}</div>
<div class="interactive-box">
<h4>🎵 برای تمرکز بیشتر</h4>
<button class="btn btn-accent" onclick="playFocusSound()">🎵 صدای تمرکز</button>
<button class="btn btn-secondary" onclick="stopSound()">🔇 قطع صدا</button>
</div>
<div style="display:flex; gap:12px; justify-content:center; margin-top:20px; flex-wrap:wrap;">
<button class="btn btn-primary" onclick="markLessonComplete('${id}')">✅ مطالعه کردم</button>
<button class="btn btn-accent" onclick="startQuiz('${id}')">📝 آزمون این درس</button>
<button class="btn btn-secondary" onclick="showFlashcardForLesson('${id}')">🃏 فلشکارت</button>
<button class="btn btn-secondary" onclick="openNoteForLesson('${id}')">📝 یادداشت</button>
</div>`;
lesson.progress = 50;
renderLessonCards();
playSound('open');
window.scrollTo({top:0, behavior:'smooth'});
}
function closeLesson() {
document.getElementById('lessonList').style.display = 'block';
document.getElementById('lessonDetail').style.display = 'none';
state.currentLesson = null;
}
function markLessonComplete(id) {
if(!state.lessonsCompleted.has(id)) {
state.lessonsCompleted.add(id);
lessonsData[id].progress = 100;
state.totalScore += 50;
addXP(30);
state.coins += 10;
addActivity('lesson', lessonsData[id].title);
updateDailyChallenge('lesson', id);
checkAchievements();
saveState();
updateStats();
renderLessonCards();
showNotification('آفرین! +۳۰ XP +۱۰ سکه 🎉', 'success');
playSound('success');
createConfetti();
} else {
showNotification('این درس قبلاً مطالعه شده', 'info');
}
}
function bookmarkLesson(id) {
const idx = state.bookmarks.indexOf(id);
if(idx > -1) {
state.bookmarks.splice(idx, 1);
showNotification('بوکمارک حذف شد', 'info');
} else {
state.bookmarks.push(id);
showNotification('بوکمارک اضافه شد 🔖', 'success');
}
saveState();
openLesson(id);
}
function openNoteForLesson(id) {
const existing = state.notes.find(n => n.lessonId === id);
const note = prompt('یادداشت خود را بنویسید:', existing ? existing.text : '');
if(note !== null && note.trim()) {
if(existing) {
existing.text = note;
existing.date = new Date().toISOString();
} else {
state.notes.push({lessonId: id, text: note, date: new Date().toISOString()});
}
saveState();
showNotification('یادداشت ذخیره شد 📝', 'success');
checkAchievements();
}
}
// ============ QUIZ ============
function startQuiz(filter) {
let questions, timed = false, timeLimit = 0;
if(filter === 'all') {
questions = [...allQuestions];
} else if(filter === 'timed') {
questions = shuffleArray([...allQuestions]).slice(0, 20);
timed = true;
timeLimit = 600;
} else if(filter === 'adaptive') {
const weakLessons = Object.entries(state.weakTopics).sort((a,b) => b[1]-a[1]).slice(0, 3).map(e => e[0]);
questions = weakLessons.length > 0 ? allQuestions.filter(q => weakLessons.includes(q.lesson)) : [...allQuestions];
questions = shuffleArray(questions).slice(0, 20);
} else if(filter === 'weak') {
const weakLessons = Object.keys(state.weakTopics);
questions = weakLessons.length > 0 ? allQuestions.filter(q => weakLessons.includes(q.lesson)) : [...allQuestions];
questions = shuffleArray(questions).slice(0, 20);
} else {
questions = allQuestions.filter(q => q.lesson === filter);
}
questions = shuffleArray(questions);
state.quizState = {
questions, current: 0, answers: [], score: 0,
startTime: Date.now(), filter, timed, timeLimit, timeRemaining: timeLimit
};
document.getElementById('quizSetup').style.display = 'none';
document.getElementById('quizArea').style.display = 'block';
document.getElementById('quizResults').style.display = 'none';
renderQuestion();
playSound('start');
if(timed) startQuizTimer();
}
let quizTimerInterval = null;
function startQuizTimer() {
if(quizTimerInterval) clearInterval(quizTimerInterval);
quizTimerInterval = setInterval(() => {
if(!state.quizState) { clearInterval(quizTimerInterval); return; }
state.quizState.timeRemaining--;
updateTimerDisplay();
if(state.quizState.timeRemaining <= 0) {
clearInterval(quizTimerInterval);
showQuizResults();
}
}, 1000);
}
function updateTimerDisplay() {
const timerEl = document.getElementById('quizTimer');
if(timerEl && state.quizState) {
const mins = Math.floor(state.quizState.timeRemaining / 60);
const secs = state.quizState.timeRemaining % 60;
timerEl.textContent = `⏱️ ${mins}:${secs.toString().padStart(2, '0')}`;
if(state.quizState.timeRemaining < 60) timerEl.style.color = 'var(--danger)';
}
}
function renderQuestion() {
const qs = state.quizState;
if(!qs) return;
const q = qs.questions[qs.current];
if(!q) { showQuizResults(); return; }
const typeLabels = {
'multiple': {text:'چهارگزینهای', color:'var(--primary)'},
'truefalse': {text:'درست/غلط', color:'var(--accent)'},
'fillblank': {text:'جای خالی', color:'var(--accent2)'},
'ordering': {text:'مرتبسازی', color:'var(--secondary)'}
};
const tl = typeLabels[q.type] || typeLabels.multiple;
let html = `<div class="quiz-container">
<div class="quiz-header">
<div class="quiz-progress">
<span>سؤال ${qs.current+1} از ${qs.questions.length}</span>
<div style="width:200px; height:6px; background:rgba(255,255,255,0.1); border-radius:3px;">
<div style="width:${((qs.current)/qs.questions.length)*100}%; height:100%; background:linear-gradient(90deg, var(--primary), var(--accent)); border-radius:3px; transition:width 0.3s;"></div>
</div>
</div>
<div style="display:flex; gap:12px; align-items:center;">
${qs.timed ? `<span id="quizTimer" class="quiz-timer">⏱️ ${Math.floor(qs.timeRemaining/60)}:${(qs.timeRemaining%60).toString().padStart(2,'0')}</span>` : ''}
<span style="color:var(--success)">✅ ${qs.score}</span>
<span style="color:var(--danger)">❌ ${qs.current - qs.score}</span>
</div>
</div>
<div class="quiz-question">
<div class="q-number">سؤال ${qs.current+1}</div>
<span class="q-type" style="background:${tl.color}20; color:${tl.color}">${tl.text}</span>
<div class="q-text">${q.q}</div>`;
if(q.type === 'multiple') {
const letters = ['الف','ب','ج','د'];
html += `<div class="quiz-options">`;
q.opts.forEach((opt, i) => {
html += `<div class="quiz-option" onclick="selectOption(${i})" id="opt-${i}">
<span class="opt-letter">${letters[i]}</span><span>${opt}</span></div>`;
});
html += `</div>`;
} else if(q.type === 'truefalse') {
html += `<div class="tf-buttons">
<button class="tf-btn true-btn" onclick="selectTF(true)">✅ درست</button>
<button class="tf-btn false-btn" onclick="selectTF(false)">❌ غلط</button>
</div>`;
} else if(q.type === 'fillblank') {
html += `<div style="text-align:center; margin:20px 0;">
<input type="text" class="fill-blank-input" id="fillInput" placeholder="پاسخ..." onkeypress="if(event.key==='Enter')submitFill()">
<br><br><button class="btn btn-primary" onclick="submitFill()">ثبت پاسخ</button></div>`;
} else if(q.type === 'ordering') {
const items = q.items || [];
const shuffled = shuffleArray([...items.map((item,i) => ({item, origIdx:i}))]);
html += `<ul class="order-list" id="orderList">`;
shuffled.forEach((s,i) => {
html += `<li class="order-item" draggable="true" data-orig="${s.origIdx}" ondragstart="dragStart(event)" ondragover="dragOver(event)" ondrop="drop(event)">
<span class="order-num">${i+1}</span><span>${s.item}</span></li>`;
});
html += `</ul><div style="text-align:center; margin-top:16px;">
<button class="btn btn-primary" onclick="submitOrdering()">ثبت ترتیب</button></div>`;
}
html += `<div class="quiz-explanation" id="explanation">💡 ${q.explain}</div></div></div>`;
document.getElementById('quizArea').innerHTML = html;
}
function selectOption(idx) {
const qs = state.quizState;
const q = qs.questions[qs.current];
const correct = idx === q.correct;
document.querySelectorAll('.quiz-option').forEach((el,i) => {
el.style.pointerEvents = 'none';
if(i === q.correct) el.classList.add('correct');
if(i === idx && !correct) el.classList.add('wrong');
});
processAnswer(correct, q);
}
function selectTF(val) {
const qs = state.quizState;
const q = qs.questions[qs.current];
const correct = val === q.correct;
document.querySelectorAll('.tf-btn').forEach(b => b.style.pointerEvents = 'none');
processAnswer(correct, q);
}
function submitFill() {
const qs = state.quizState;
const q = qs.questions[qs.current];
const input = document.getElementById('fillInput');
const val = input.value.trim();
const correct = q.correct.some(c => val.includes(c) || c.includes(val));
input.classList.add(correct ? 'correct' : 'wrong');
input.disabled = true;
processAnswer(correct, q);
}
function submitOrdering() {
const qs = state.quizState;
const q = qs.questions[qs.current];
const items = document.querySelectorAll('#orderList .order-item');
const order = [...items].map(i => parseInt(i.dataset.orig));
const correct = JSON.stringify(order) === JSON.stringify(q.correct);
processAnswer(correct, q);
}
function processAnswer(correct, q) {
const qs = state.quizState;
if(correct) {
qs.score++;
state.correctAnswers++;
state.streak++;
state.maxStreak = Math.max(state.maxStreak, state.streak);
state.totalScore += 10;
addXP(5);
state.coins += 2;
playSound('correct');
updateDailyChallenge('correct', 1);
} else {
state.streak = 0;
playSound('wrong');
state.weakTopics[q.lesson] = (state.weakTopics[q.lesson] || 0) + 1;
}
state.totalAnswered++;
qs.answers.push({q, correct});
document.getElementById('explanation').classList.add('show');
setTimeout(() => {
qs.current++;
if(qs.current >= qs.questions.length) {
if(quizTimerInterval) clearInterval(quizTimerInterval);
showQuizResults();
} else {
renderQuestion();
}
}, correct ? 1500 : 3000);
updateStats();
saveState();
}
function showQuizResults() {
const qs = state.quizState;
if(!qs) return;
const pct = Math.round((qs.score / qs.questions.length) * 100);
const time = Math.round((Date.now() - qs.startTime) / 1000);
const mins = Math.floor(time/60);
const secs = time % 60;
const bonusXP = Math.floor(pct / 10) * 5;
const bonusCoins = Math.floor(pct / 20) * 5;
addXP(bonusXP);
state.coins += bonusCoins;
checkAchievements();
saveState();
updateStats();
document.getElementById('quizArea').style.display = 'none';
const results = document.getElementById('quizResults');
results.style.display = 'block';
let emoji = pct >= 90 ? '🏆' : pct >= 70 ? '🎉' : pct >= 50 ? '👍' : '💪';
let msg = pct >= 90 ? 'عالی! تسلط کامل!' : pct >= 70 ? 'خیلی خوب!' : pct >= 50 ? 'قابل قبول!' : 'بیشتر تلاش کن!';
const lessonScores = {};
qs.answers.forEach(a => {
if(!lessonScores[a.q.lesson]) lessonScores[a.q.lesson] = {correct:0, total:0};
lessonScores[a.q.lesson].total++;
if(a.correct) lessonScores[a.q.lesson].correct++;
});
let analysisHtml = '<h3 style="margin:20px 0 12px;">📊 تحلیل عملکرد:</h3>';
Object.entries(lessonScores).forEach(([lid, s]) => {
const l = lessonsData[lid];
const lp = Math.round((s.correct/s.total)*100);
const color = lp >= 80 ? 'var(--success)' : lp >= 50 ? 'var(--accent2)' : 'var(--danger)';
analysisHtml += `<div style="display:flex; align-items:center; gap:12px; margin:8px 0;">
<span>${l.icon}</span><span style="flex:1">${l.title.replace(/درس \d: /,'')}</span>
<div style="width:150px; height:8px; background:rgba(255,255,255,0.1); border-radius:4px;">
<div style="width:${lp}%; height:100%; background:${color}; border-radius:4px;"></div>
</div><span style="color:${color}; font-weight:700;">${lp}%</span></div>`;
});
results.innerHTML = `<div class="results-container">
<h2>${emoji} نتیجه آزمون</h2>
<div class="results-score" style="--score-pct:${pct}%"><span>${pct}%</span><small>${qs.score} از ${qs.questions.length}</small></div>
<h3 style="color:${pct>=70?'var(--success)':'var(--accent2)'}">${msg}</h3>
<p style="color:var(--text-dim); margin:12px 0;">⏱ زمان: ${mins}:${secs.toString().padStart(2,'0')}</p>
<div style="margin:16px 0; padding:16px; background:var(--glass); border-radius:12px;">
<p>⭐ +${bonusXP} XP</p><p>🪙 +${bonusCoins} سکه</p>
</div>
${analysisHtml}
<div style="display:flex; gap:12px; justify-content:center; margin-top:30px; flex-wrap:wrap;">
<button class="btn btn-primary" onclick="reviewWrongAnswers()">🔍 مرور اشتباهات</button>
<button class="btn btn-accent" onclick="startQuiz('${qs.filter}')">🔄 آزمون مجدد</button>
<button class="btn btn-secondary" onclick="showSection('quiz')">📝 بازگشت</button>
</div></div>`;
if(pct >= 70) createConfetti();
playSound(pct >= 70 ? 'success' : 'complete');
addActivity('quiz', `آزمون - ${pct}%`);
}
function reviewWrongAnswers() {
const qs = state.quizState;
const wrong = qs.answers.filter(a => !a.correct);
let html = `<div class="quiz-container"><h2 style="margin-bottom:20px;">🔍 مرور اشتباهات (${wrong.length})</h2>`;
wrong.forEach(a => {
const q = a.q;
let correctAnswer = '';
if(q.type === 'multiple' && q.opts) correctAnswer = q.opts[q.correct];
else if(q.type === 'truefalse') correctAnswer = q.correct ? 'درست' : 'غلط';
else if(q.type === 'fillblank') correctAnswer = q.correct[0];
else if(q.type === 'ordering') correctAnswer = q.correct.map(i => q.items[i]).join(' ← ');
html += `<div class="quiz-question" style="margin-bottom:16px;">
<div class="q-text">${q.q}</div>
<div style="padding:12px; background:rgba(0,200,83,0.1); border-radius:8px; margin:8px 0;">✅ پاسخ صحیح: ${correctAnswer}</div>
<div class="quiz-explanation show">💡 ${q.explain}</div></div>`;
});
html += `<div style="text-align:center; margin-top:20px;">
<button class="btn btn-primary" onclick="showSection('quiz')">بازگشت</button></div></div>`;
document.getElementById('quizResults').innerHTML = html;
}
// ============ GAMES ============
function startGame(type) {
const area = document.getElementById('gameArea');
area.innerHTML = '';
if(type === 'flashcards') startFlashcards(area);
else if(type === 'matching') startMatching(area);
else if(type === 'mindmap') startMindmap(area);
else if(type === 'ordering') startOrderingGame(area);
else if(type === 'truefalse') startTrueFalseGame(area);
else if(type === 'fillblank') startFillBlankGame(area);
else if(type === 'memory') startMemoryGame(area);
else if(type === 'speed') startSpeedGame(area);
else if(type === 'word') startWordGame(area);
playSound('start');
if(!state.gamesPlayed.includes(type)) {
state.gamesPlayed.push(type);
saveState();
checkAchievements();
}
}
function startFlashcards(area) {
let idx = 0;
const cards = shuffleArray([...flashcardsData]);
function render() {
const c = cards[idx];
area.innerHTML = `<div style="text-align:center">
<h3>🃏 فلشکارت (${idx+1}/${cards.length})</h3>
<div class="flashcard-container">
<div class="flashcard" id="flashcard" onclick="this.classList.toggle('flipped')">
<div class="flashcard-face flashcard-front"><h3>${c.front}</h3><p style="margin-top:12px; font-size:0.9em">کلیک کنید</p></div>
<div class="flashcard-face flashcard-back"><p>${c.back}</p></div>
</div>
</div>
<div style="display:flex; gap:12px; justify-content:center; margin-top:20px;">
<button class="btn btn-secondary" onclick="window._flashPrev()" ${idx===0?'disabled':''}>← قبلی</button>
<button class="btn btn-primary" onclick="window._flashNext()">${idx===cards.length-1?'پایان':'بعدی →'}</button>
</div></div>`;
}
window._flashPrev = () => { if(idx>0){idx--;render();} };
window._flashNext = () => {
if(idx<cards.length-1){ idx++; render(); updateDailyChallenge('flashcards', 1); }
else {
area.innerHTML='<div style="text-align:center;padding:40px"><h2>🎉 آفرین!</h2><p style="color:var(--accent2)">+۱۰ سکه +۲۰ XP</p><button class="btn btn-primary" onclick="startGame(\'flashcards\')" style="margin-top:20px">🔄 مرور مجدد</button></div>';
state.coins += 10;
addXP(20);
saveState();
updateStats();
}
};
render();
}
function showFlashcardForLesson(lessonId) {
showSection('games');
setTimeout(() => startGame('flashcards'), 100);
}
function startMatching(area) {
const pairs = shuffleArray([...matchingData]).slice(0, 8);
const terms = shuffleArray(pairs.map((p,i) => ({text:p.term, pairId:i, type:'term'})));
const defs = shuffleArray(pairs.map((p,i) => ({text:p.def, pairId:i, type:'def'})));
const allCards = shuffleArray([...terms, ...defs]);
let selected = null, matched = new Set(), moves = 0;
function render() {
area.innerHTML = `<div style="text-align:center">
<h3>🔗 بازی تطبیق</h3>
<p style="color:var(--text-dim); margin:8px 0">مفاهیم را جفت کنید • حرکات: <span id="moveCount">${moves}</span></p>
<div class="match-grid" id="matchGrid">
${allCards.map((c,i) => `<div class="match-card ${matched.has(i)?'matched':''}" data-idx="${i}" onclick="window._matchClick(${i})">
${matched.has(i) ? '✅ '+c.text : c.text}</div>`).join('')}
</div></div>`;
}
window._matchClick = (idx) => {
if(matched.has(idx)) return;
const card = allCards[idx];
if(selected === null) {
selected = idx;
document.querySelectorAll('.match-card')[idx].classList.add('selected');
playSound('click');
} else {
const first = allCards[selected];
moves++;
const mc = document.getElementById('moveCount');
if(mc) mc.textContent = moves;
if(first.pairId === card.pairId && first.type !== card.type) {
matched.add(selected);
matched.add(idx);
playSound('correct');
selected = null;
if(matched.size === allCards.length) {
setTimeout(() => {
area.innerHTML = `<div style="text-align:center; padding:40px">
<h2>🎉 آفرین!</h2><p>حرکات: ${moves}</p>
<p style="color:var(--accent2)">+۲۰ سکه +۳۰ XP</p>
<button class="btn btn-primary" onclick="startGame('matching')" style="margin-top:20px">🔄 مجدد</button></div>`;
state.totalScore += 30;
state.coins += 20;
addXP(30);
createConfetti();
playSound('success');
saveState();
updateStats();
}, 500);
}
} else {
playSound('wrong');
const cards = document.querySelectorAll('.match-card');
cards[selected].classList.add('wrong');
cards[idx].classList.add('wrong');
const s = selected;
setTimeout(() => {
cards[s].classList.remove('selected','wrong');
cards[idx].classList.remove('wrong');
}, 600);
selected = null;
}
}
};
render();
}
function startMindmap(area) {
area.innerHTML = `<div style="text-align:center">
<h3>🧩 نقشه ذهنی تعاملی</h3>
<p style="color:var(--text-dim); margin:8px 0">روی هر گره کلیک کنید</p>
</div>
<div class="mindmap-container" style="height:500px; position:relative;">
<svg width="100%" height="100%" style="position:absolute; top:0; left:0;">
<line x1="50%" y1="50%" x2="20%" y2="20%" stroke="rgba(108,99,255,0.3)" stroke-width="2"/>
<line x1="50%" y1="50%" x2="80%" y2="20%" stroke="rgba(255,101,132,0.3)" stroke-width="2"/>
<line x1="50%" y1="50%" x2="20%" y2="80%" stroke="rgba(0,210,255,0.3)" stroke-width="2"/>
<line x1="50%" y1="50%" x2="80%" y2="80%" stroke="rgba(255,217,61,0.3)" stroke-width="2"/>
<line x1="50%" y1="50%" x2="50%" y2="15%" stroke="rgba(0,200,83,0.3)" stroke-width="2"/>
</svg>
<div class="mindmap-node mindmap-center" style="top:45%; left:42%;" onclick="showMindmapInfo('center')">🧠 تفکر و رسانه</div>
<div class="mindmap-node mindmap-branch" style="top:12%; left:12%; border-color:var(--primary);" onclick="showMindmapInfo('l1')">📺 رسانه</div>
<div class="mindmap-node mindmap-branch" style="top:12%; right:12%; border-color:var(--secondary);" onclick="showMindmapInfo('l2')">🔍 سواد</div>
<div class="mindmap-node mindmap-branch" style="bottom:12%; left:12%; border-color:var(--accent);" onclick="showMindmapInfo('l3')">🪞 بازنمایی</div>
<div class="mindmap-node mindmap-branch" style="bottom:12%; right:12%; border-color:var(--accent2);" onclick="showMindmapInfo('l4')">💰 اقتصاد</div>
<div class="mindmap-node mindmap-branch" style="top:8%; left:42%; border-color:var(--success);" onclick="showMindmapInfo('l5')">👥 مخاطب</div>
</div>
<div id="mindmapInfo" style="margin-top:20px;"></div>`;
}
function showMindmapInfo(key) {
const info = {
center: '<div class="lesson-content"><h3>🧠 تفکر و رسانه</h3><p>۵ بخش اصلی.</p></div>',
l1: '<div class="lesson-content"><h3>📺 رسانه</h3><p>مکلوهان: «رسانه همان پیام است».</p></div>',
l2: '<div class="lesson-content"><h3>🔍 سواد رسانهای</h3><p>۵ سؤال کلیدی.</p></div>',
l3: '<div class="lesson-content"><h3>🪞 بازنمایی</h3><p>رسانه لنز است، نه آینه.</p></div>',
l4: '<div class="lesson-content"><h3>💰 اقتصاد سیاسی</h3><p>مدل ۵ فیلتر.</p></div>',
l5: '<div class="lesson-content"><h3>👥 مخاطب</h3><p>از منفعل تا مشارکتجو.</p></div>'
};
document.getElementById('mindmapInfo').innerHTML = info[key] || '';
playSound('click');
}
function startOrderingGame(area) {
const orderQuestions = [
{q:'ترتیب ظهور رسانهها:', items:['شفاهی','چاپی','رادیو','تلویزیون','اینترنت'], correct:[0,1,2,3,4]},
{q:'فیلترهای هرمان و چامسکی:', items:['مالکیت','تبلیغات','منابع رسمی','فشار','ایدئولوژی'], correct:[0,1,2,3,4]},
{q:'سیر تحول مخاطب:', items:['منفعل','استفاده و خشنودی','رمزگذاری/رمزگشایی','مشارکتجو'], correct:[0,1,2,3]},
{q:'مؤلفههای سواد رسانهای:', items:['آگاهی','دانش','تحلیل','ارزیابی','خلق','مشارکت'], correct:[0,1,2,3,4,5]}
];
const q = orderQuestions[Math.floor(Math.random()*orderQuestions.length)];
const shuffled = shuffleArray(q.items.map((item,i) => ({item, origIdx:i})));
function render() {
area.innerHTML = `<div style="text-align:center">
<h3>📊 مرتبسازی</h3>
<p style="color:var(--text-dim); margin:8px 0">${q.q}</p>
</div>
<ul class="order-list" style="max-width:500px; margin:20px auto;">
${shuffled.map((s,i) => `<li class="order-item" draggable="true" data-idx="${i}"
ondragstart="window._gameDragStart(event,${i})"
ondragover="event.preventDefault()"
ondrop="window._gameDrop(event,${i})">
<span class="order-num">${i+1}</span><span>${s.item}</span></li>`).join('')}
</ul>
<div style="text-align:center"><button class="btn btn-primary" onclick="window._checkOrdering()">بررسی</button></div>
<div id="orderResult" style="margin-top:16px;"></div>`;
}
let dragIdx = null;
window._gameDragStart = (e, idx) => { dragIdx = idx; e.dataTransfer.effectAllowed = 'move'; };
window._gameDrop = (e, targetIdx) => {
e.preventDefault();
if(dragIdx === null || dragIdx === targetIdx) return;
[shuffled[dragIdx], shuffled[targetIdx]] = [shuffled[targetIdx], shuffled[dragIdx]];
dragIdx = null;
render();
playSound('click');
};
window._checkOrdering = () => {
const order = shuffled.map(s => s.origIdx);
const correct = JSON.stringify(order) === JSON.stringify(q.correct);
const result = document.getElementById('orderResult');
if(correct) {
result.innerHTML = '<div style="color:var(--success); font-size:1.2em; font-weight:700">✅ صحیح!</div>';
state.totalScore += 20;
state.coins += 10;
addXP(20);
playSound('success');
createConfetti();
} else {
result.innerHTML = `<div style="color:var(--danger)">❌ ترتیب صحیح: ${q.correct.map(i => q.items[i]).join(' ← ')}</div>`;
playSound('wrong');
}
saveState();
updateStats();
};
render();
}
function startTrueFalseGame(area) {
const tfQuestions = allQuestions.filter(q => q.type === 'truefalse');
const selected = shuffleArray(tfQuestions).slice(0, Math.min(15, tfQuestions.length));
let idx = 0, score = 0;
function render() {
if(idx >= selected.length) {
area.innerHTML = `<div style="text-align:center; padding:40px">
<h2>🎉 پایان!</h2>
<p style="font-size:1.5em; margin:16px 0">امتیاز: ${score} از ${selected.length}</p>
<p style="color:var(--accent2)">+${score * 2} سکه +${score * 5} XP</p>
<button class="btn btn-primary" onclick="startGame('truefalse')">🔄 مجدد</button></div>`;
state.coins += score * 2;
addXP(score * 5);
saveState();
updateStats();
return;
}
const q = selected[idx];
area.innerHTML = `<div style="text-align:center; max-width:600px; margin:0 auto;">
<h3>⚡ درست یا غلط (${idx+1}/${selected.length})</h3>
<div class="quiz-question" style="margin:20px 0">
<div class="q-text">${q.q}</div>
<div class="tf-buttons">
<button class="tf-btn true-btn" onclick="window._tfAnswer(true)">✅ درست</button>
<button class="tf-btn false-btn" onclick="window._tfAnswer(false)">❌ غلط</button>
</div>
<div id="tfFeedback" style="margin-top:16px;"></div>
</div></div>`;
}
window._tfAnswer = (val) => {
const q = selected[idx];
const correct = val === q.correct;
if(correct) { score++; playSound('correct'); }
else playSound('wrong');
document.getElementById('tfFeedback').innerHTML = correct ?
'<div style="color:var(--success); font-weight:700">✅ صحیح!</div>' :
`<div style="color:var(--danger)">❌ پاسخ: ${q.correct ? 'درست' : 'غلط'}</div>`;
setTimeout(() => { idx++; render(); }, 1200);
};
render();
}
function startFillBlankGame(area) {
const fbQuestions = allQuestions.filter(q => q.type === 'fillblank');
const extraFB = [
{q:'«رسانه همان ______ است» از مکلوهان.', correct:['پیام'], explain:'رسانه همان پیام است.'},
{q:'______ رسانهای یعنی تحلیل انتقادی.', correct:['سواد'], explain:'سواد رسانهای.'},
{q:'رسانه مانند ______ عمل میکند.', correct:['لنز'], explain:'رسانه لنز است.'},
{q:'تصویر سادهشده از یک گروه: ______.', correct:['کلیشه'], explain:'کلیشه.'},
{q:'در اقتصاد توجه، توجه = ______.', correct:['درآمد'], explain:'توجه = درآمد.'},
{q:'نظریه ______: درباره چه فکر کنیم.', correct:['برجستهسازی'], explain:'برجستهسازی.'},
{q:'______ یعنی تولید-مصرفکننده.', correct:['Produser'], explain:'Produser.'}
];
const all = shuffleArray([...fbQuestions, ...extraFB]).slice(0, 10);
let idx = 0, score = 0;
function render() {
if(idx >= all.length) {
area.innerHTML = `<div style="text-align:center; padding:40px">
<h2>🎉 پایان!</h2>
<p style="font-size:1.5em">امتیاز: ${score} از ${all.length}</p>
<p style="color:var(--accent2)">+${score * 2} سکه +${score * 5} XP</p>
<button class="btn btn-primary" onclick="startGame('fillblank')">🔄 مجدد</button></div>`;
state.coins += score * 2;
addXP(score * 5);
saveState();
updateStats();
return;
}
const q = all[idx];
area.innerHTML = `<div style="text-align:center; max-width:600px; margin:0 auto;">
<h3>✏️ جای خالی (${idx+1}/${all.length})</h3>
<div class="quiz-question" style="margin:20px 0">
<div class="q-text">${q.q}</div>
<input type="text" id="fbInput" class="fill-blank-input" placeholder="پاسخ..." style="font-size:1.2em; padding:12px;" autofocus>
<br><br><button class="btn btn-primary" onclick="window._fbCheck()">ثبت</button>
<div id="fbFeedback" style="margin-top:16px;"></div>
</div></div>`;
setTimeout(() => {
const inp = document.getElementById('fbInput');
if(inp) {
inp.focus();
inp.onkeypress = (e) => { if(e.key==='Enter') window._fbCheck(); };
}
}, 100);
}
window._fbCheck = () => {
const q = all[idx];
const val = document.getElementById('fbInput').value.trim();
const correct = q.correct.some(c => val.includes(c) || c.includes(val));
if(correct) { score++; playSound('correct'); }
else playSound('wrong');
document.getElementById('fbFeedback').innerHTML = correct ?
'<div style="color:var(--success); font-weight:700">✅ صحیح!</div>' :
`<div style="color:var(--danger)">❌ پاسخ: ${q.correct[0]}</div><div style="color:var(--text-dim); margin-top:8px">${q.explain}</div>`;
setTimeout(() => { idx++; render(); }, 2000);
};
render();
}
function startMemoryGame(area) {
const pairs = shuffleArray([...matchingData]).slice(0, 8);
const cards = shuffleArray([
...pairs.map((p,i) => ({text:p.term, pairId:i, type:'term'})),
...pairs.map((p,i) => ({text:p.def, pairId:i, type:'def'}))
]);
let flipped = [], matched = new Set(), moves = 0;
function render() {
area.innerHTML = `<div style="text-align:center">
<h3>🧠 بازی حافظه</h3>
<p style="color:var(--text-dim); margin:8px 0">جفتها را پیدا کنید • حرکات: <span id="memMoves">${moves}</span></p>
<div class="memory-grid">
${cards.map((c,i) => `<div class="memory-card ${matched.has(i)?'matched':''} ${flipped.includes(i)?'flipped':''}" onclick="window._memClick(${i})">
<span class="card-front">❓</span><span class="card-back">${c.text}</span></div>`).join('')}
</div></div>`;
}
window._memClick = (idx) => {
if(matched.has(idx) || flipped.includes(idx) || flipped.length >= 2) return;
flipped.push(idx);
playSound('click');
render();
if(flipped.length === 2) {
moves++;
const mm = document.getElementById('memMoves');
if(mm) mm.textContent = moves;
const [i1, i2] = flipped;
const c1 = cards[i1], c2 = cards[i2];
if(c1.pairId === c2.pairId && c1.type !== c2.type) {
matched.add(i1);
matched.add(i2);
playSound('correct');
flipped = [];
if(matched.size === cards.length) {
setTimeout(() => {
area.innerHTML = `<div style="text-align:center; padding:40px">
<h2>🎉 آفرین!</h2><p>حرکات: ${moves}</p>
<p style="color:var(--accent2)">+۲۰ سکه +۳۰ XP</p>
<button class="btn btn-primary" onclick="startGame('memory')" style="margin-top:20px">🔄 مجدد</button></div>`;
state.coins += 20;
addXP(30);
createConfetti();
playSound('success');
saveState();
updateStats();
}, 500);
}
setTimeout(render, 500);
} else {
setTimeout(() => { flipped = []; render(); }, 1000);
}
}
};
render();
}
function startSpeedGame(area) {
const questions = shuffleArray([...allQuestions].filter(q => q.type === 'multiple' && q.opts)).slice(0, 10);
let idx = 0, score = 0, startTime = Date.now();
function render() {
if(idx >= questions.length) {
const time = Math.round((Date.now() - startTime) / 1000);
area.innerHTML = `<div style="text-align:center; padding:40px">
<h2>⚡ پایان!</h2>
<p style="font-size:1.5em; margin:16px 0">امتیاز: ${score} از ${questions.length}</p>
<p>زمان: ${time} ثانیه</p>
<p style="color:var(--accent2)">+${score * 3} سکه +${score * 5} XP</p>
<button class="btn btn-primary" onclick="startGame('speed')">🔄 مجدد</button></div>`;
state.coins += score * 3;
addXP(score * 5);
saveState();
updateStats();
return;
}
const q = questions[idx];
area.innerHTML = `<div style="text-align:center; max-width:600px; margin:0 auto;">
<h3>⚡ بازی سرعت (${idx+1}/${questions.length})</h3>
<div class="quiz-question" style="margin:20px 0">
<div class="q-text">${q.q}</div>
<div class="quiz-options">
${q.opts.map((opt, i) => `<div class="quiz-option" onclick="window._speedAnswer(${i}, ${q.correct})">
<span class="opt-letter">${['الف','ب','ج','د'][i]}</span><span>${opt}</span></div>`).join('')}
</div></div></div>`;
}
window._speedAnswer = (selected, correct) => {
if(selected === correct) { score++; playSound('correct'); }
else playSound('wrong');
idx++;
setTimeout(render, 300);
};
render();
}
function startWordGame(area) {
const words = [
{word:'رسانه', hint:'وسیله انتقال پیام'},
{word:'مک لوهان', hint:'نظریهپرداز «رسانه همان پیام است»'},
{word:'کلیشه', hint:'تصویر سادهشده از یک گروه'},
{word:'بازنمایی', hint:'ساختن معنا از واقعیت'},
{word:'سواد', hint:'توانایی تحلیل انتقادی'},
{word:'اقناع', hint:'تکنیک متقاعد کردن'},
{word:'پروپاگاندا', hint:'مدل ۵ فیلتر'},
{word:'مخاطب', hint:'دریافتکننده پیام'}
];
const selected = shuffleArray(words).slice(0, 5);
let idx = 0, score = 0;
function render() {
if(idx >= selected.length) {
area.innerHTML = `<div style="text-align:center; padding:40px">
<h2>🔤 پایان!</h2>
<p style="font-size:1.5em">امتیاز: ${score} از ${selected.length}</p>
<p style="color:var(--accent2)">+${score * 3} سکه +${score * 5} XP</p>
<button class="btn btn-primary" onclick="startGame('word')">🔄 مجدد</button></div>`;
state.coins += score * 3;
addXP(score * 5);
saveState();
updateStats();
return;
}
const w = selected[idx];
const letters = w.word.split('');
const shuffledLetters = shuffleArray([...letters, ...Array(3).fill('_')]);
area.innerHTML = `<div style="text-align:center; max-width:600px; margin:0 auto;">
<h3>🔤 بازی کلمات (${idx+1}/${selected.length})</h3>
<div class="quiz-question" style="margin:20px 0">
<p style="color:var(--text-dim); margin-bottom:16px">💡 ${w.hint}</p>
<div id="wordSlots" style="display:flex; gap:8px; justify-content:center; margin:20px 0; min-height:60px; flex-wrap:wrap;">
${letters.map(() => `<div style="width:50px; height:50px; border:2px dashed var(--glass-border); border-radius:8px; display:flex; align-items:center; justify-content:center; font-size:1.5em;"></div>`).join('')}
</div>
<div id="letterPool" style="display:flex; gap:8px; justify-content:center; flex-wrap:wrap; margin:20px 0;">
${shuffledLetters.map((l, i) => `<button class="btn btn-secondary" onclick="window._pickLetter(${i}, '${l}')" style="min-width:50px; min-height:50px; font-size:1.5em;">${l}</button>`).join('')}
</div>
<button class="btn btn-primary" onclick="window._checkWord()">بررسی</button>
<button class="btn btn-secondary" onclick="window._resetWord()">پاک کردن</button>
<div id="wordFeedback" style="margin-top:16px;"></div>
</div></div>`;
window._currentWord = w.word;
window._pickedLetters = [];
}
window._pickLetter = (idx, letter) => {
if(letter === '_') return;
const btn = document.querySelectorAll('#letterPool button')[idx];
if(btn.disabled) return;
btn.disabled = true;
btn.style.opacity = '0.3';
window._pickedLetters.push(letter);
updateWordSlots();
};
window._resetWord = () => {
window._pickedLetters = [];
document.querySelectorAll('#letterPool button').forEach(btn => {
btn.disabled = false;
btn.style.opacity = '1';
});
updateWordSlots();
};
window.updateWordSlots = () => {
const slots = document.querySelectorAll('#wordSlots div');
slots.forEach((slot, i) => {
slot.textContent = window._pickedLetters[i] || '';
});
};
window._checkWord = () => {
const word = window._pickedLetters.join('');
const feedback = document.getElementById('wordFeedback');
if(word === window._currentWord) {
score++;
feedback.innerHTML = '<div style="color:var(--success); font-weight:700">✅ صحیح!</div>';
playSound('correct');
setTimeout(() => { idx++; render(); }, 1500);
} else {
feedback.innerHTML = `<div style="color:var(--danger)">❌ پاسخ: ${window._currentWord}</div>`;
playSound('wrong');
setTimeout(() => { idx++; render(); }, 2000);
}
};
render();
}
// ============ REVIEW ============
function showReviewTab(tab, event) {
document.querySelectorAll('#sec-review .tab').forEach(t => t.classList.remove('active'));
if(event && event.target) event.target.classList.add('active');
else document.querySelector(`#sec-review .tab`)?.classList.add('active');
const content = document.getElementById('reviewContent');
if(tab === 'progress') {
const totalLessons = 5;
const done = state.lessonsCompleted.size;
const pct = Math.round((done/totalLessons)*100);
content.innerHTML = `<div class="lesson-content">
<h3>📈 پیشرفت کلی</h3>
<div style="display:flex; align-items:center; gap:20px; margin:20px 0; flex-wrap:wrap;">
<div style="width:120px; height:120px; border-radius:50%; background:conic-gradient(var(--primary) ${pct}%, rgba(255,255,255,0.1) 0); display:flex; align-items:center; justify-content:center;">
<div style="width:100px; height:100px; border-radius:50%; background:var(--darker); display:flex; align-items:center; justify-content:center; font-size:1.5em; font-weight:700;">${pct}%</div>
</div>
<div style="flex:1; min-width:200px;">
<p>📚 درسها: ${done} از ${totalLessons}</p>
<p>✅ پاسخ صحیح: ${state.correctAnswers}</p>
<p>📝 کل پاسخها: ${state.totalAnswered}</p>
<p>🎯 دقت: ${state.totalAnswered ? Math.round((state.correctAnswers/state.totalAnswered)*100) : 0}%</p>
<p>⭐ امتیاز: ${state.totalScore}</p>
<p>🔥 بیشترین streak: ${state.maxStreak}</p>
<p>⭐ سطح: ${state.level}</p>
<p>🪙 سکه: ${state.coins}</p>
</div></div>
<h4>پیشرفت هر درس:</h4>
${Object.values(lessonsData).map(l => `<div style="display:flex; align-items:center; gap:12px; margin:12px 0;">
<span style="font-size:1.5em">${l.icon}</span>
<div style="flex:1">
<div style="display:flex; justify-content:space-between; margin-bottom:4px;">
<span>${l.title}</span><span>${l.progress}%</span>
</div>
<div style="height:8px; background:rgba(255,255,255,0.1); border-radius:4px;">
<div style="width:${l.progress}%; height:100%; background:${l.color}; border-radius:4px;"></div>
</div></div></div>`).join('')}
</div>`;
} else if(tab === 'weaknesses') {
const weakEntries = Object.entries(state.weakTopics).sort((a,b) => b[1]-a[1]);
content.innerHTML = `<div class="lesson-content">
<h3>🎯 نقاط ضعف</h3>
${weakEntries.length === 0 ? '<p style="color:var(--text-dim)">هنوز آزمونی ندادهاید.</p>' :
weakEntries.map(([lid, count]) => {
const l = lessonsData[lid];
return `<div class="card" style="margin:12px 0; cursor:pointer;" onclick="openLesson('${lid}'); showSection('lessons');">
<div style="display:flex; align-items:center; gap:12px;">
<span style="font-size:2em">${l.icon}</span>
<div style="flex:1"><h4>${l.title}</h4>
<p style="color:var(--danger)">${count} پاسخ اشتباه</p></div>
<button class="btn btn-sm btn-primary">مطالعه</button>
</div></div>`;
}).join('')}
</div>`;
} else if(tab === 'achievements') {
const allAch = [
{id:'first_lesson', icon:'📖', title:'اولین درس', desc:'اولین درس را مطالعه کنید', check:()=>state.lessonsCompleted.size>=1},
{id:'all_lessons', icon:'🎓', title:'دانشآموخته', desc:'تمام درسها', check:()=>state.lessonsCompleted.size>=5},
{id:'first_quiz', icon:'📝', title:'اولین آزمون', desc:'اولین آزمون', check:()=>state.totalAnswered>0},
{id:'perfect_score', icon:'💯', title:'نمره کامل', desc:'۵۰۰ امتیاز', check:()=>state.totalScore>=500},
{id:'streak_5', icon:'🔥', title:'آتشین', desc:'۵ پاسخ متوالی', check:()=>state.maxStreak>=5},
{id:'streak_10', icon:'⚡', title:'برقآسا', desc:'۱۰ پاسخ متوالی', check:()=>state.maxStreak>=10},
{id:'streak_20', icon:'🌟', title:'افسانهای', desc:'۲۰ پاسخ متوالی', check:()=>state.maxStreak>=20},
{id:'score_100', icon:'⭐', title:'ستاره', desc:'۱۰۰ امتیاز', check:()=>state.totalScore>=100},
{id:'score_500', icon:'🏆', title:'قهرمان', desc:'۵۰۰ امتیاز', check:()=>state.totalScore>=500},
{id:'score_1000', icon:'👑', title:'پادشاه', desc:'۱۰۰۰ امتیاز', check:()=>state.totalScore>=1000},
{id:'answers_50', icon:'📊', title:'پرسشگر', desc:'۵۰ سؤال', check:()=>state.totalAnswered>=50},
{id:'answers_100', icon:'🎯', title:'ماهر', desc:'۱۰۰ سؤال', check:()=>state.totalAnswered>=100},
{id:'answers_500', icon:'💎', title:'استاد', desc:'۵۰۰ سؤال', check:()=>state.totalAnswered>=500},
{id:'level_5', icon:'🚀', title:'پرواز', desc:'سطح ۵', check:()=>state.level>=5},
{id:'level_10', icon:'🌠', title:'ستارهای', desc:'سطح ۱۰', check:()=>state.level>=10},
{id:'coins_100', icon:'💰', title:'ثروتمند', desc:'۱۰۰ سکه', check:()=>state.coins>=100},
{id:'coins_500', icon:'🏦', title:'بانکدار', desc:'۵۰۰ سکه', check:()=>state.coins>=500},
{id:'daily_7', icon:'📅', title:'متعهد', desc:'۷ روز متوالی', check:()=>state.maxStreak>=7},
{id:'daily_30', icon:'🗓️', title:'مصمم', desc:'۳۰ روز متوالی', check:()=>state.maxStreak>=30},
{id:'bookmark_5', icon:'🔖', title:'نشانهگذار', desc:'۵ بوکمارک', check:()=>state.bookmarks.length>=5},
{id:'note_5', icon:'📝', title:'نویسنده', desc:'۵ یادداشت', check:()=>state.notes.length>=5},
{id:'all_games', icon:'🎮', title:'بازیکن', desc:'همه بازیها', check:()=>state.gamesPlayed.length>=9}
];
const unlocked = allAch.filter(a => a.check()).length;
content.innerHTML = `<div class="lesson-content">
<h3>🏆 دستاوردها (${unlocked}/${allAch.length})</h3>
${allAch.map(a => {
const u = a.check();
return `<div class="achievement ${u?'unlocked':''}">
<div class="ach-icon">${u ? a.icon : '🔒'}</div>
<div class="ach-info"><h4>${a.title}</h4><p>${a.desc}</p></div>
${u ? '<span style="color:var(--success)">✅</span>' : ''}
</div>`;
}).join('')}
</div>`;
} else if(tab === 'analytics') {
content.innerHTML = `<div class="lesson-content">
<h3>📊 تحلیل عملکرد</h3>
<div style="display:grid; grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); gap:16px; margin:20px 0;">
<div style="background:var(--glass); padding:20px; border-radius:12px; text-align:center;">
<div style="font-size:2em; color:var(--accent);">${state.totalAnswered ? Math.round((state.correctAnswers/state.totalAnswered)*100) : 0}%</div>
<div style="color:var(--text-dim); margin-top:8px;">دقت کلی</div>
</div>
<div style="background:var(--glass); padding:20px; border-radius:12px; text-align:center;">
<div style="font-size:2em; color:var(--success);">${state.correctAnswers}</div>
<div style="color:var(--text-dim); margin-top:8px;">پاسخ صحیح</div>
</div>
<div style="background:var(--glass); padding:20px; border-radius:12px; text-align:center;">
<div style="font-size:2em; color:var(--danger);">${state.totalAnswered - state.correctAnswers}</div>
<div style="color:var(--text-dim); margin-top:8px;">پاسخ غلط</div>
</div>
<div style="background:var(--glass); padding:20px; border-radius:12px; text-align:center;">
<div style="font-size:2em; color:var(--accent2);">${state.maxStreak}</div>
<div style="color:var(--text-dim); margin-top:8px;">بیشترین streak</div>
</div>
</div>
<h4 style="margin-top:24px;">🎯 نقاط قوت و ضعف</h4>
<div style="margin-top:12px;">
${Object.entries(lessonsData).map(([lid, l]) => {
const wrong = state.weakTopics[lid] || 0;
const color = wrong === 0 ? 'var(--success)' : wrong < 3 ? 'var(--accent2)' : 'var(--danger)';
return `<div style="display:flex; align-items:center; gap:12px; margin:8px 0;">
<span>${l.icon}</span><span style="flex:1">${l.title.replace(/درس \d: /,'')}</span>
<span style="color:${color}; font-weight:700;">${wrong === 0 ? '✅ عالی' : wrong + ' اشتباه'}</span>
</div>`;
}).join('')}
</div></div>`;
} else if(tab === 'bookmarks') {
content.innerHTML = `<div class="lesson-content">
<h3>🔖 بوکمارکها</h3>
${state.bookmarks.length === 0 ? '<p style="color:var(--text-dim)">هنوز بوکمارکی ندارید.</p>' :
state.bookmarks.map(id => {
const l = lessonsData[id];
return `<div class="card" style="margin:12px 0; cursor:pointer;" onclick="openLesson('${id}'); showSection('lessons');">
<div style="display:flex; align-items:center; gap:12px;">
<span style="font-size:2em">${l.icon}</span>
<div style="flex:1"><h4>${l.title}</h4></div>
<button class="btn btn-sm btn-danger" onclick="event.stopPropagation(); removeBookmark('${id}')">حذف</button>
</div></div>`;
}).join('')}
</div>`;
} else if(tab === 'notes') {
content.innerHTML = `<div class="lesson-content">
<h3>📝 یادداشتها</h3>
${state.notes.length === 0 ? '<p style="color:var(--text-dim)">هنوز یادداشتی ندارید.</p>' :
state.notes.map((n, i) => {
const l = lessonsData[n.lessonId];
return `<div class="card" style="margin:12px 0;">
<div style="display:flex; align-items:center; gap:12px; margin-bottom:12px;">
<span style="font-size:2em">${l.icon}</span>
<div style="flex:1"><h4>${l.title}</h4>
<p style="color:var(--text-dim); font-size:0.75em">${new Date(n.date).toLocaleString('fa-IR')}</p></div>
<button class="btn btn-sm btn-danger" onclick="deleteNote(${i})">حذف</button>
</div>
<p style="padding:12px; background:var(--glass); border-radius:8px;">${n.text}</p>
</div>`;
}).join('')}
</div>`;
} else if(tab === 'formulas') {
content.innerHTML = `<div class="lesson-content">
<h3>🧪 فرمولهای یادگیری</h3>
<div class="key-point"><strong>۱. منحنی فراموشی ابینگهاوس:</strong><p>۷۰٪ مطالب در ۲۴ ساعت فراموش میشود!</p><p><strong>راهحل:</strong> مرور در فواصل.</p></div>
<div class="highlight"><strong>۲. تکنیک فاینمن:</strong><ol><li>مفهوم را انتخاب کنید</li><li>به زبان ساده توضیح دهید</li><li>نقاط ضعف را شناسایی کنید</li><li>سادهتر توضیح دهید</li></ol></div>
<div class="key-point"><strong>۳. یادگیری فعال:</strong><p>فقط خواندن = ۱۰٪</p><p>خواندن + نوشتن = ۳۰٪</p><p>تمرین = ۵۰٪</p><p>آموزش به دیگران = ۹۰٪</p></div>
<div class="highlight"><strong>۴. Active Recall:</strong><p>به جای دوباره خواندن، از خودتان سؤال بپرسید.</p></div>
<div class="key-point"><strong>💡 برنامه امتحان:</strong><ol><li>درس را بخوانید</li><li>فلشکارت مرور کنید</li><li>آزمون بدهید</li><li>اشتباهات را تحلیل کنید</li><li>فردا مرور کنید</li></ol></div>
</div>`;
}
}
function removeBookmark(id) {
const idx = state.bookmarks.indexOf(id);
if(idx > -1) {
state.bookmarks.splice(idx, 1);
saveState();
showReviewTab('bookmarks');
showNotification('بوکمارک حذف شد', 'info');
}
}
function deleteNote(idx) {
if(confirm('آیا مطمئن هستید؟')) {
state.notes.splice(idx, 1);
saveState();
showReviewTab('notes');
showNotification('یادداشت حذف شد', 'info');
}
}
// ============ PROFILE ============
function updateProfile() {
const content = document.getElementById('profileContent');
if(!content) return;
const xpNeeded = state.level * 100;
const xpPct = Math.round((state.xp / xpNeeded) * 100);
content.innerHTML = `
<div class="profile-header">
<div class="profile-avatar">${state.avatar}</div>
<div class="profile-name">${state.userName}</div>
<div class="profile-level">⭐ سطح ${state.level}</div>
<div class="profile-xp-bar"><div class="profile-xp-fill" style="width:${xpPct}%"></div></div>
<p style="color:var(--text-dim); font-size:0.9em;">${state.xp} / ${xpNeeded} XP تا سطح بعدی</p>
<div class="profile-stats">
<div class="profile-stat"><div class="stat-value">${state.totalScore}</div><div class="stat-label">امتیاز</div></div>
<div class="profile-stat"><div class="stat-value">${state.coins}</div><div class="stat-label">🪙 سکه</div></div>
<div class="profile-stat"><div class="stat-value">${state.correctAnswers}</div><div class="stat-label">✅ صحیح</div></div>
<div class="profile-stat"><div class="stat-value">${state.maxStreak}</div><div class="stat-label">🔥 استریک</div></div>
<div class="profile-stat"><div class="stat-value">${state.lessonsCompleted.size}/5</div><div class="stat-label">📚 درس</div></div>
<div class="profile-stat"><div class="stat-value">${state.achievements.length}</div><div class="stat-label">🏆 دستاورد</div></div>
</div>
</div>
<div class="lesson-content">
<h3>⚙️ تنظیمات پروفایل</h3>
<div style="margin:16px 0;">
<label style="display:block; margin-bottom:8px;">نام کاربری:</label>
<input type="text" id="userNameInput" value="${state.userName}" style="padding:10px; border-radius:8px; border:1px solid var(--glass-border); background:var(--glass); color:var(--text); font-family:inherit; width:100%; max-width:300px;">
</div>
<div style="margin:16px 0;">
<label style="display:block; margin-bottom:8px;">آواتار:</label>
<div style="display:flex; gap:8px; flex-wrap:wrap;">
${['🧠','🎓','🚀','⭐','🎯','🏆','💎','🌟','🔥','⚡','🎨','🎮'].map(a => `<button class="btn ${state.avatar===a?'btn-primary':'btn-secondary'}" onclick="changeAvatar('${a}')" style="font-size:1.5em; padding:8px 16px;">${a}</button>`).join('')}
</div>
</div>
<button class="btn btn-primary" onclick="saveProfile()">💾 ذخیره</button>
</div>
<div class="lesson-content">
<h3>🎨 تنظیمات ظاهری</h3>
<div style="margin:16px 0;">
<label style="display:block; margin-bottom:8px;">تم:</label>
<div style="display:flex; gap:8px;">
<button class="btn ${state.theme==='dark'?'btn-primary':'btn-secondary'}" onclick="setTheme('dark')">🌙 تاریک</button>
<button class="btn ${state.theme==='light'?'btn-primary':'btn-secondary'}" onclick="setTheme('light')">☀️ روشن</button>
</div>
</div>
<div style="margin:16px 0;">
<label style="display:block; margin-bottom:8px;">اندازه فونت: <span id="fontSizeLabel">${state.fontSize}px</span></label>
<input type="range" min="14" max="20" value="${state.fontSize}" oninput="setFontSize(this.value)" style="width:100%; max-width:300px;">
</div>
</div>
<div class="lesson-content">
<h3>💾 مدیریت دادهها</h3>
<div style="display:flex; gap:12px; flex-wrap:wrap; margin-top:16px;">
<button class="btn btn-accent" onclick="exportData()">📤 خروجی</button>
<button class="btn btn-secondary" onclick="document.getElementById('importFile').click()">📥 ورود</button>
<input type="file" id="importFile" style="display:none" accept=".json" onchange="importData(event)">
<button class="btn btn-danger" onclick="resetData()">🗑️ ریست</button>
</div>
</div>`;
}
function changeAvatar(avatar) {
state.avatar = avatar;
saveState();
updateProfile();
}
function saveProfile() {
const name = document.getElementById('userNameInput').value.trim();
if(name) {
state.userName = name;
saveState();
showNotification('ذخیره شد ✅', 'success');
updateProfile();
}
}
function setTheme(theme) {
state.theme = theme;
applyTheme();
saveState();
updateProfile();
}
function applyTheme() {
document.documentElement.setAttribute('data-theme', state.theme);
}
function setFontSize(size) {
state.fontSize = parseInt(size);
applyFontSize();
const label = document.getElementById('fontSizeLabel');
if(label) label.textContent = size + 'px';
saveState();
}
function applyFontSize() {
document.documentElement.style.setProperty('--font-size', state.fontSize + 'px');
}
function exportData() {
const data = JSON.stringify({...state, lessonsCompleted: [...state.lessonsCompleted]}, null, 2);
const blob = new Blob([data], {type: 'application/json'});
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `media-literacy-backup-${new Date().toISOString().split('T')[0]}.json`;
a.click();
URL.revokeObjectURL(url);
showNotification('دادهها خروجی گرفته شد 📤', 'success');
}
function importData(event) {
const file = event.target.files[0];
if(!file) return;
const reader = new FileReader();
reader.onload = (e) => {
try {
const data = JSON.parse(e.target.result);
state = {...state, ...data, lessonsCompleted: new Set(data.lessonsCompleted || [])};
saveState();
showNotification('دادهها وارد شد ✅', 'success');
init();
} catch(err) {
showNotification('خطا در ورود ❌', 'error');
}
};
reader.readAsText(file);
}
function resetData() {
if(confirm('تمام پیشرفت پاک میشود!')) {
if(confirm('قابل بازگشت نیست. ادامه؟')) {
localStorage.removeItem('mediaLit_state_v2');
location.reload();
}
}
}
// ============ AI CHAT ============
function toggleAi() {
document.getElementById('aiPanel').classList.toggle('open');
}
function askAi(question) {
document.getElementById('aiInput').value = question;
sendAiMsg();
}
function sendAiMsg() {
const input = document.getElementById('aiInput');
const msg = input.value.trim();
if(!msg) return;
const msgs = document.getElementById('aiMessages');
msgs.innerHTML += `<div class="ai-msg user"><div class="msg-bubble">${msg}</div></div>`;
input.value = '';
setTimeout(() => {
const response = generateAiResponse(msg);
msgs.innerHTML += `<div class="ai-msg bot"><div class="msg-bubble">${response}</div></div>`;
msgs.scrollTop = msgs.scrollHeight;
playSound('notification');
}, 800);
msgs.scrollTop = msgs.scrollHeight;
}
function generateAiResponse(msg) {
const lower = msg.toLowerCase();
const kb = {
'رسانه': 'رسانه هر ابزار، کانال یا وسیلهای است که پیام منتقل میکند. مکلوهان: «رسانه همان پیام است».',
'مک لوهان': 'مارشال مکلوهان (۱۹۱۱-۱۹۸۰). جمله مشهور: «رسانه همان پیام است».',
'سواد': 'سواد رسانهای: توانایی دسترسی، تحلیل، ارزیابی و خلق پیام. ۵ سؤال کلیدی دارد.',
'بازنمایی': 'بازنمایی یعنی ساختن معنا از واقعیت. رسانه لنز است، نه آینه.',
'کلیشه': 'کلیشه تصویری سادهشده و تعمیمیافته از یک گروه.',
'اقتصاد': 'اقتصاد سیاسی رسانه رابطه اقتصاد، قدرت و محتوا را بررسی میکند.',
'مخاطب': 'مخاطب از منفعل به فعال به مشارکتجو تحول یافته.',
'هرمان': 'مدل ۵ فیلتر: مالکیت، تبلیغات، منابع رسمی، فشار، ایدئولوژی.',
'هال': 'استوارت هال: سه قرائت - غالب، مذاکراتی، تقابلی.',
'برجسته': 'برجستهسازی: رسانه میگوید «درباره چه فکر کنیم».',
'کاشت': 'کاشت: تماشای طولانی تلویزیون جهانبینی را شکل میدهد.',
'مارپیچ': 'مارپیچ سکوت: خودداری از بیان نظر اقلیت.',
'produser': 'Produser = تولید-مصرفکننده.',
'امتحان': 'برای امتحان: ۱.درس بخوان ۲.فلشکارت ۳.آزمون ۴.تحلیل ۵.مرور.',
'تکنیک': 'تکنیکهای اقناع: تکرار، ترس، شواهد اجتماعی، افراد مشهور، سادگی، احساسات، برچسبزنی.'
};
for(const [key, value] of Object.entries(kb)) {
if(lower.includes(key)) return value;
}
if(lower.includes('سلام') || lower.includes('hi')) return 'سلام! 👋 چطور کمکت کنم؟';
if(lower.includes('کمک')) return 'میتونم درباره:\n• رسانه\n• سواد رسانهای\n• بازنمایی\n• اقتصاد سیاسی\n• مخاطبشناسی\nکمکت کنم.';
if(lower.includes('درس')) return '۵ درس:\n۱. مفهوم رسانه\n۲. سواد رسانهای\n۳. بازنمایی\n۴. اقتصاد سیاسی\n۵. مخاطبشناسی';
return 'درباره یکی از این موضوعات بپرس:\n• رسانه\n• سواد رسانهای\n• بازنمایی\n• اقتصاد سیاسی\n• مخاطبشناسی';
}
// ============ UTILITIES ============
function shuffleArray(arr) {
const a = [...arr];
for(let i=a.length-1; i>0; i--) {
const j = Math.floor(Math.random()*(i+1));
[a[i], a[j]] = [a[j], a[i]];
}
return a;
}
function updateStats() {
document.getElementById('totalScore').textContent = state.totalScore;
document.getElementById('streakCount').textContent = state.streak;
document.getElementById('userLevel').textContent = state.level;
document.getElementById('userCoins').textContent = state.coins;
document.getElementById('statLessons').textContent = state.lessonsCompleted.size + '/5';
document.getElementById('statCorrect').textContent = state.correctAnswers;
document.getElementById('statAccuracy').textContent = state.totalAnswered ? Math.round((state.correctAnswers/state.totalAnswered)*100)+'%' : '0%';
document.getElementById('statAchievements').textContent = state.achievements.length;
const totalProgress = (state.lessonsCompleted.size * 20) + Math.min(state.totalAnswered, 100);
document.getElementById('mainProgress').style.width = Math.min(totalProgress, 100) + '%';
}
function checkAchievements() {
const allAch = [
{id:'first_lesson', check:()=>state.lessonsCompleted.size>=1},
{id:'all_lessons', check:()=>state.lessonsCompleted.size>=5},
{id:'first_quiz', check:()=>state.totalAnswered>0},
{id:'perfect_score', check:()=>state.totalScore>=500},
{id:'streak_5', check:()=>state.maxStreak>=5},
{id:'streak_10', check:()=>state.maxStreak>=10},
{id:'streak_20', check:()=>state.maxStreak>=20},
{id:'score_100', check:()=>state.totalScore>=100},
{id:'score_500', check:()=>state.totalScore>=500},
{id:'score_1000', check:()=>state.totalScore>=1000},
{id:'answers_50', check:()=>state.totalAnswered>=50},
{id:'answers_100', check:()=>state.totalAnswered>=100},
{id:'answers_500', check:()=>state.totalAnswered>=500},
{id:'level_5', check:()=>state.level>=5},
{id:'level_10', check:()=>state.level>=10},
{id:'coins_100', check:()=>state.coins>=100},
{id:'coins_500', check:()=>state.coins>=500},
{id:'daily_7', check:()=>state.maxStreak>=7},
{id:'daily_30', check:()=>state.maxStreak>=30},
{id:'bookmark_5', check:()=>state.bookmarks.length>=5},
{id:'note_5', check:()=>state.notes.length>=5},
{id:'all_games', check:()=>state.gamesPlayed.length>=9}
];
allAch.forEach(a => {
if(a.check() && !state.achievements.includes(a.id)) {
state.achievements.push(a.id);
showAchievementModal(a.id);
}
});
}
function showAchievementModal(id) {
const achs = {
'first_lesson': {icon:'📖', title:'اولین درس'},
'all_lessons': {icon:'🎓', title:'دانشآموخته'},
'first_quiz': {icon:'📝', title:'اولین آزمون'},
'perfect_score': {icon:'💯', title:'نمره کامل'},
'streak_5': {icon:'🔥', title:'آتشین'},
'streak_10': {icon:'⚡', title:'برقآسا'},
'streak_20': {icon:'🌟', title:'افسانهای'},
'score_100': {icon:'⭐', title:'ستاره'},
'score_500': {icon:'🏆', title:'قهرمان'},
'score_1000': {icon:'👑', title:'پادشاه'},
'answers_50': {icon:'📊', title:'پرسشگر'},
'answers_100': {icon:'🎯', title:'ماهر'},
'answers_500': {icon:'💎', title:'استاد'},
'level_5': {icon:'🚀', title:'پرواز'},
'level_10': {icon:'🌠', title:'ستارهای'},
'coins_100': {icon:'💰', title:'ثروتمند'},
'coins_500': {icon:'🏦', title:'بانکدار'},
'daily_7': {icon:'📅', title:'متعهد'},
'daily_30': {icon:'🗓️', title:'مصمم'},
'bookmark_5': {icon:'🔖', title:'نشانهگذار'},
'note_5': {icon:'📝', title:'نویسنده'},
'all_games': {icon:'🎮', title:'بازیکن'}
};
const ach = achs[id];
if(!ach) return;
const modal = document.getElementById('achievementModal');
const body = document.getElementById('achievementModalBody');
body.innerHTML = `<div style="text-align:center; padding:20px;">
<div style="font-size:4em; margin-bottom:16px;">${ach.icon}</div>
<h2 style="color:var(--accent2); margin-bottom:12px;">${ach.title}</h2>
<p style="color:var(--text-dim); margin-bottom:20px;">دستاورد جدید!</p>
<button class="btn btn-primary" onclick="closeModal('achievementModal')">عالیه!</button>
</div>`;
modal.classList.add('open');
playSound('success');
createConfetti();
}
function addActivity(type, text) {
state.activities.unshift({type, text, date: new Date().toISOString()});
if(state.activities.length > 20) state.activities = state.activities.slice(0, 20);
saveState();
updateRecentActivity();
}
function updateRecentActivity() {
const container = document.getElementById('recentActivity');
if(!container) return;
if(state.activities.length === 0) {
container.innerHTML = '<p style="color:var(--text-dim); text-align:center; padding:20px;">هنوز فعالیتی ندارید</p>';
return;
}
container.innerHTML = state.activities.slice(0, 5).map(a => {
const icons = {lesson:'📖', quiz:'📝', game:'🎮', achievement:'🏆'};
const time = getTimeAgo(new Date(a.date));
return `<div class="activity-item">
<div class="activity-icon">${icons[a.type] || '📌'}</div>
<div class="activity-info"><h4>${a.text}</h4><p>${time}</p></div>
</div>`;
}).join('');
}
function getTimeAgo(date) {
const seconds = Math.floor((new Date() - date) / 1000);
if(seconds < 60) return 'چند لحظه پیش';
if(seconds < 3600) return Math.floor(seconds/60) + ' دقیقه پیش';
if(seconds < 86400) return Math.floor(seconds/3600) + ' ساعت پیش';
return Math.floor(seconds/86400) + ' روز پیش';
}
function showNotification(msg, type='info') {
const container = document.getElementById('notifications');
const n = document.createElement('div');
n.className = `notification ${type}`;
const icons = {success:'✅', error:'❌', info:'ℹ️', warning:'⚠️'};
n.innerHTML = `<span>${icons[type] || ''}</span><span>${msg}</span>`;
container.appendChild(n);
setTimeout(() => {
n.style.animation = 'slideDown 0.3s ease reverse';
setTimeout(() => n.remove(), 300);
}, 3000);
}
function createConfetti() {
const colors = ['#6C63FF','#FF6584','#00D2FF','#FFD93D','#00C853'];
for(let i=0; i<50; i++) {
const c = document.createElement('div');
c.className = 'confetti-piece';
c.style.left = Math.random()*100 + '%';
c.style.background = colors[Math.floor(Math.random()*colors.length)];
c.style.animationDelay = Math.random()*2 + 's';
c.style.borderRadius = Math.random() > 0.5 ? '50%' : '0';
document.body.appendChild(c);
setTimeout(() => c.remove(), 4000);
}
}
// ============ SOUND ============
let audioCtx = null;
let currentOsc = null;
function getAudioCtx() {
if(!audioCtx) audioCtx = new (window.AudioContext || window.webkitAudioContext)();
return audioCtx;
}
function playSound(type) {
try {
const ctx = getAudioCtx();
const osc = ctx.createOscillator();
const gain = ctx.createGain();
osc.connect(gain);
gain.connect(ctx.destination);
switch(type) {
case 'click':
osc.frequency.value = 800;
gain.gain.setValueAtTime(0.1, ctx.currentTime);
gain.gain.exponentialRampToValueAtTime(0.01, ctx.currentTime + 0.1);
osc.start(); osc.stop(ctx.currentTime + 0.1);
break;
case 'correct':
osc.frequency.value = 523;
gain.gain.setValueAtTime(0.15, ctx.currentTime);
gain.gain.exponentialRampToValueAtTime(0.01, ctx.currentTime + 0.3);
osc.start(); osc.stop(ctx.currentTime + 0.3);
setTimeout(() => {
const o2 = ctx.createOscillator();
const g2 = ctx.createGain();
o2.connect(g2); g2.connect(ctx.destination);
o2.frequency.value = 659;
g2.gain.setValueAtTime(0.15, ctx.currentTime);
g2.gain.exponentialRampToValueAtTime(0.01, ctx.currentTime + 0.3);
o2.start(); o2.stop(ctx.currentTime + 0.3);
}, 150);
break;
case 'wrong':
osc.type = 'sawtooth';
osc.frequency.value = 200;
gain.gain.setValueAtTime(0.1, ctx.currentTime);
gain.gain.exponentialRampToValueAtTime(0.01, ctx.currentTime + 0.4);
osc.start(); osc.stop(ctx.currentTime + 0.4);
break;
case 'success':
[523, 659, 784, 1047].forEach((f, i) => {
setTimeout(() => {
const o = ctx.createOscillator();
const g = ctx.createGain();
o.connect(g); g.connect(ctx.destination);
o.frequency.value = f;
g.gain.setValueAtTime(0.12, ctx.currentTime);
g.gain.exponentialRampToValueAtTime(0.01, ctx.currentTime + 0.3);
o.start(); o.stop(ctx.currentTime + 0.3);
}, i * 120);
});
break;
case 'open':
osc.frequency.value = 440;
osc.frequency.exponentialRampToValueAtTime(880, ctx.currentTime + 0.2);
gain.gain.setValueAtTime(0.08, ctx.currentTime);
gain.gain.exponentialRampToValueAtTime(0.01, ctx.currentTime + 0.2);
osc.start(); osc.stop(ctx.currentTime + 0.2);
break;
case 'start':
osc.frequency.value = 330;
osc.frequency.exponentialRampToValueAtTime(660, ctx.currentTime + 0.3);
gain.gain.setValueAtTime(0.1, ctx.currentTime);
gain.gain.exponentialRampToValueAtTime(0.01, ctx.currentTime + 0.3);
osc.start(); osc.stop(ctx.currentTime + 0.3);
break;
case 'notification':
osc.frequency.value = 880;
gain.gain.setValueAtTime(0.08, ctx.currentTime);
gain.gain.exponentialRampToValueAtTime(0.01, ctx.currentTime + 0.15);
osc.start(); osc.stop(ctx.currentTime + 0.15);
break;
case 'complete':
osc.frequency.value = 440;
gain.gain.setValueAtTime(0.1, ctx.currentTime);
gain.gain.exponentialRampToValueAtTime(0.01, ctx.currentTime + 0.3);
osc.start(); osc.stop(ctx.currentTime + 0.3);
break;
}
} catch(e) {}
}
function playFocusSound() {
try {
const ctx = getAudioCtx();
if(currentOsc) { stopSound(); return; }
const osc1 = ctx.createOscillator();
const osc2 = ctx.createOscillator();
const gain = ctx.createGain();
const filter = ctx.createBiquadFilter();
osc1.type = 'sine'; osc1.frequency.value = 174;
osc2.type = 'sine'; osc2.frequency.value = 262;
filter.type = 'lowpass'; filter.frequency.value = 400;
osc1.connect(filter); osc2.connect(filter);
filter.connect(gain); gain.connect(ctx.destination);
gain.gain.setValueAtTime(0, ctx.currentTime);
gain.gain.linearRampToValueAtTime(0.05, ctx.currentTime + 1);
osc1.start(); osc2.start();
currentOsc = {osc1, osc2, gain};
showNotification('🎵 صدای تمرکز فعال شد', 'info');
} catch(e) {}
}
function stopSound() {
if(currentOsc) {
try {
currentOsc.gain.gain.linearRampToValueAtTime(0, getAudioCtx().currentTime + 0.5);
setTimeout(() => {
try { currentOsc.osc1.stop(); currentOsc.osc2.stop(); } catch(e){}
currentOsc = null;
}, 600);
} catch(e) { currentOsc = null; }
}
showNotification('🔇 قطع شد', 'info');
}
function dragStart(e) { e.dataTransfer.setData('text/plain', e.target.dataset.orig); }
function dragOver(e) { e.preventDefault(); }
function drop(e) { e.preventDefault(); }
init();
</script>
</body>
</html>
<html lang="fa" dir="rtl" data-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>🧠 تفکر و رسانه | نسخه ۲.۰</title>
<link href="https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css" rel="stylesheet">
<style>
:root {
--primary: #6C63FF;
--primary-dark: #5A52D5;
--secondary: #FF6584;
--accent: #00D2FF;
--accent2: #FFD93D;
--success: #00C853;
--danger: #FF5252;
--dark: #1a1a2e;
--darker: #16213e;
--card: #0f3460;
--text: #e8e8e8;
--text-dim: #a0a0b0;
--glass: rgba(255,255,255,0.06);
--glass-border: rgba(255,255,255,0.1);
--radius: 16px;
--shadow: 0 8px 32px rgba(0,0,0,0.3);
--font-size: 16px;
}
[data-theme="light"] {
--dark: #f5f5f7;
--darker: #ffffff;
--card: #ffffff;
--text: #1a1a2e;
--text-dim: #666;
--glass: rgba(0,0,0,0.04);
--glass-border: rgba(0,0,0,0.1);
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
font-family: 'Vazirmatn', sans-serif;
background: var(--dark);
color: var(--text);
min-height: 100vh;
overflow-x: hidden;
font-size: var(--font-size);
transition: background 0.3s, color 0.3s;
}
.bg-animation { position: fixed; top:0; left:0; width:100%; height:100%; z-index: 0; overflow: hidden; pointer-events: none; }
.bg-animation .orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.3; animation: orbFloat 20s ease-in-out infinite; }
.bg-animation .orb:nth-child(1) { width:400px; height:400px; background:var(--primary); top:-100px; right:-100px; }
.bg-animation .orb:nth-child(2) { width:300px; height:300px; background:var(--secondary); bottom:-50px; left:-50px; animation-delay:-7s; }
.bg-animation .orb:nth-child(3) { width:350px; height:350px; background:var(--accent); top:50%; left:50%; animation-delay:-14s; }
@keyframes orbFloat { 0%,100% { transform: translate(0,0) scale(1); } 25% { transform: translate(50px,-80px) scale(1.1); } 50% { transform: translate(-30px,60px) scale(0.9); } 75% { transform: translate(70px,30px) scale(1.05); } }
.particles { position:fixed; top:0; left:0; width:100%; height:100%; z-index:0; pointer-events:none; }
.particle { position:absolute; width:4px; height:4px; background:var(--accent); border-radius:50%; opacity:0; animation: particleAnim linear infinite; }
@keyframes particleAnim { 0% { opacity:0; transform:translateY(100vh) scale(0); } 10% { opacity:0.8; } 90% { opacity:0.8; } 100% { opacity:0; transform:translateY(-10vh) scale(1); } }
.app { position:relative; z-index:1; }
.nav { position:fixed; top:0; left:0; right:0; z-index:100; background: rgba(26,26,46,0.85); backdrop-filter:blur(20px); border-bottom:1px solid var(--glass-border); padding:0 20px; height:64px; display:flex; align-items:center; justify-content:space-between; }
[data-theme="light"] .nav { background: rgba(255,255,255,0.85); }
.nav-brand { display:flex; align-items:center; gap:10px; font-size:1.2em; font-weight:700; }
.nav-brand svg { width:36px; height:36px; }
.nav-links { display:flex; gap:4px; }
.nav-link { padding:8px 16px; border-radius:12px; cursor:pointer; transition:all 0.3s; font-size:0.9em; border:none; background:transparent; color:var(--text-dim); font-family:inherit; }
.nav-link:hover, .nav-link.active { background:var(--glass); color:var(--accent); }
.nav-stats { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.stat-badge { display:flex; align-items:center; gap:6px; padding:6px 12px; background:var(--glass); border-radius:20px; font-size:0.85em; }
.stat-badge .icon { font-size:1.1em; }
.progress-bar-container { position:fixed; top:64px; left:0; right:0; height:4px; background:rgba(255,255,255,0.05); z-index:99; }
.progress-bar { height:100%; background:linear-gradient(90deg, var(--primary), var(--accent), var(--secondary)); border-radius:0 2px 2px 0; transition:width 0.5s ease; box-shadow:0 0 10px var(--accent); }
.main { padding-top:80px; min-height:100vh; }
.section { display:none; padding:20px; max-width:1200px; margin:0 auto; }
.section.active { display:block; animation:fadeInSection 0.5s ease; }
@keyframes fadeInSection { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
.hero { text-align:center; padding:60px 20px; background:linear-gradient(135deg, rgba(108,99,255,0.15), rgba(0,210,255,0.1)); border-radius:24px; margin-bottom:40px; border:1px solid var(--glass-border); position:relative; overflow:hidden; }
.hero::before { content:''; position:absolute; top:-50%; left:-50%; width:200%; height:200%; background:conic-gradient(from 0deg, transparent, rgba(108,99,255,0.1), transparent, rgba(0,210,255,0.1), transparent); animation:heroRotate 15s linear infinite; }
@keyframes heroRotate { to { transform:rotate(360deg); } }
.hero-content { position:relative; z-index:1; }
.hero h1 { font-size:2.5em; margin-bottom:16px; background:linear-gradient(135deg, var(--accent), var(--primary), var(--secondary)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.hero p { font-size:1.1em; color:var(--text-dim); max-width:600px; margin:0 auto 30px; line-height:1.8; }
.hero-btns { display:flex; gap:16px; justify-content:center; flex-wrap:wrap; }
.btn { padding:12px 28px; border-radius:14px; border:none; cursor:pointer; font-family:inherit; font-size:1em; font-weight:600; transition:all 0.3s; display:inline-flex; align-items:center; gap:8px; }
.btn-primary { background:linear-gradient(135deg, var(--primary), var(--primary-dark)); color:#fff; box-shadow:0 4px 15px rgba(108,99,255,0.4); }
.btn-primary:hover { transform:translateY(-2px); box-shadow:0 6px 20px rgba(108,99,255,0.6); }
.btn-secondary { background:var(--glass); color:var(--text); border:1px solid var(--glass-border); }
.btn-secondary:hover { background:rgba(255,255,255,0.1); }
.btn-success { background:linear-gradient(135deg, var(--success), #00a844); color:#fff; }
.btn-danger { background:linear-gradient(135deg, var(--danger), #d32f2f); color:#fff; }
.btn-accent { background:linear-gradient(135deg, var(--accent), #0099cc); color:#fff; }
.btn-sm { padding:8px 16px; font-size:0.85em; border-radius:10px; }
.btn-lg { padding:16px 36px; font-size:1.1em; border-radius:16px; }
.cards-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(280px,1fr)); gap:20px; margin:30px 0; }
.card { background:var(--glass); border:1px solid var(--glass-border); border-radius:var(--radius); padding:24px; transition:all 0.3s; cursor:pointer; position:relative; overflow:hidden; }
.card:hover { transform:translateY(-4px); border-color:var(--primary); box-shadow:var(--shadow); }
.card-icon { font-size:2.5em; margin-bottom:16px; }
.card h3 { font-size:1.2em; margin-bottom:8px; }
.card p { color:var(--text-dim); font-size:0.9em; line-height:1.7; }
.card-badge { position:absolute; top:12px; left:12px; padding:4px 10px; border-radius:8px; font-size:0.75em; font-weight:600; }
.card-progress { margin-top:16px; }
.card-progress-bar { height:6px; background:rgba(255,255,255,0.1); border-radius:3px; overflow:hidden; }
.card-progress-fill { height:100%; border-radius:3px; transition:width 0.5s; }
.daily-challenge-card { background:linear-gradient(135deg, rgba(255,101,132,0.15), rgba(255,217,61,0.1)); border:1px solid rgba(255,101,132,0.3); border-radius:var(--radius); padding:20px; margin-bottom:30px; }