/**
 * Interactive Science Learning App - Styles v2
 * Science 3rd Prep - Second Term 2026
 * Supports: Web + Android (PWA/Capacitor)
 */

/* ===================== RESET & BASE ===================== */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --primary: #667eea;
  --primary-dark: #5568d3;
  --secondary: #764ba2;
  --success: #28a745;
  --success-bg: #d4edda;
  --success-text: #155724;
  --danger: #dc3545;
  --danger-bg: #f8d7da;
  --danger-text: #721c24;
  --warning: #ffc107;
  --light: #f8f9fa;
  --dark: #333;
  --gray: #666;
  --border: #dee2e6;
  --white: #fff;
  --shadow: 0 4px 15px rgba(0,0,0,0.1);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Segoe UI', Tahoma, Geneva, Verdana, Arial, sans-serif;
}

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

body {
  font-family: var(--font);
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  min-height: 100vh;
  color: var(--dark);
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ===================== LAYOUT ===================== */
.container { max-width: 900px; margin: 0 auto; padding: 12px; }

/* ===================== HEADER ===================== */
.header {
  background: var(--white);
  padding: 14px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  position: relative;
}

.header h1, #app-title {
  color: var(--primary);
  font-size: clamp(1rem, 3.5vw, 1.4rem);
  text-align: center;
  margin-bottom: 10px;
}

.stats {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stat-item {
  background: var(--light);
  padding: 6px 14px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}

.stat-icon { font-size: 1.1rem; }
.stat-value { font-weight: bold; color: var(--primary); min-width: 20px; text-align: center; }

.lang-btn {
  position: absolute !important;
  top: 14px;
  left: 14px;
  padding: 5px 12px !important;
  font-size: 12px !important;
  background: var(--primary) !important;
  color: white !important;
  border-radius: 16px !important;
  min-height: 32px !important;
}

[dir="ltr"] .lang-btn { left: auto; right: 14px; }

/* ===================== CONTENT ===================== */
#content {
  background: var(--white);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 400px;
}

.section-title { color: var(--primary); margin-bottom: 16px; font-size: 1.2rem; }

/* ===================== UNIT HEADER ===================== */
.unit-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 12px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-sm);
  color: white;
}

.unit-badge {
  background: rgba(255,255,255,0.25);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.unit-title { font-weight: 700; font-size: 0.95rem; }

/* ===================== LESSON CARDS ===================== */
.lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.lesson-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: var(--white);
  padding: 18px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
}

.lesson-card:hover, .lesson-card:focus {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  outline: none;
}

.lesson-card:active { transform: translateY(-1px); }

.character-avatar { font-size: 44px; text-align: center; margin-bottom: 8px; line-height: 1; }
.character-avatar.large { font-size: 60px; }
.lesson-title { font-size: 1rem; font-weight: bold; margin-bottom: 6px; text-align: center; }
.lesson-desc { text-align: center; opacity: 0.9; font-size: 0.8rem; }
.lesson-teacher { margin-top: 6px; font-size: 0.75rem; text-align: center; opacity: 0.8; }

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  transition: background 0.2s, transform 0.1s;
  min-height: 44px;
  touch-action: manipulation;
  user-select: none;
  text-decoration: none;
}

.btn:hover { background: var(--primary-dark); }
.btn:active { transform: scale(0.97); }
.btn:focus { outline: 3px solid rgba(102,126,234,0.5); outline-offset: 2px; }

.btn-secondary { background: #6c757d; }
.btn-secondary:hover { background: #5a6268; }

.btn-sm { padding: 7px 14px; font-size: 0.85rem; min-height: 36px; }

.btn-study { background: #17a2b8; width: 100%; margin-bottom: 10px; }
.btn-study:hover { background: #138496; }

.btn-practice { background: linear-gradient(135deg, var(--primary), var(--secondary)); width: 100%; margin-bottom: 10px; }

.btn-exam { background: #e83e8c; width: 100%; }
.btn-exam:hover { background: #d6336c; }

.back-btn { width: 100%; margin-top: 12px; }
.check-btn { width: 100%; margin-top: 16px; background: linear-gradient(135deg, var(--primary), var(--secondary)); }

/* ===================== TOP NAV ===================== */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 10px;
}

/* ===================== MODAL ===================== */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  background: rgba(0,0,0,0.5);
  animation: fadeIn 0.2s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-content {
  background: var(--white);
  margin: 4% auto 4%;
  padding: 24px 20px;
  border-radius: var(--radius);
  width: 93%;
  max-width: 560px;
  position: relative;
  animation: slideDown 0.25s ease;
}

.close-modal {
  position: absolute;
  right: 14px; top: 14px;
  font-size: 24px; font-weight: bold;
  color: #aaa; cursor: pointer;
  background: none; border: none;
  line-height: 1; padding: 4px 8px;
  border-radius: 4px; min-height: 36px; min-width: 36px;
}

.close-modal:hover { color: var(--dark); }

.modal-header { text-align: center; margin-bottom: 16px; }
.modal-title { color: var(--primary); font-size: 1.2rem; margin: 8px 0 4px; }
.modal-subtitle { color: var(--gray); font-size: 0.85rem; }
.modal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

.progress-label { text-align: center; color: var(--gray); margin-bottom: 12px; font-size: 0.85rem; }

/* ===================== PROGRESS BAR ===================== */
.progress-bar {
  width: 100%; height: 10px;
  background: #e9ecef;
  border-radius: 5px; overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.5s ease;
  border-radius: 5px;
}

/* ===================== GAMES FLOW ===================== */
.games-flow-wrapper { max-width: 600px; margin: 0 auto; }

.games-flow-header {
  text-align: center;
  margin-bottom: 20px;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius);
  color: white;
}

.games-flow-emoji { font-size: 48px; display: block; margin-bottom: 8px; }
.games-flow-header h2 { font-size: 1.2rem; margin-bottom: 4px; }
.games-flow-lesson { opacity: 0.9; font-size: 0.9rem; }

.games-flow-steps { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }

.game-step {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--light);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.game-step:hover, .game-step:focus {
  background: #e7f1ff;
  border-color: var(--primary);
  outline: none;
  transform: translateX(-3px);
}

[dir="ltr"] .game-step:hover { transform: translateX(3px); }

.game-step:active { transform: scale(0.98); }

.exam-step {
  background: #fff3f8;
  border-color: #e83e8c;
}

.exam-step:hover { background: #ffe0ef; border-color: #d6336c; }

.step-number {
  width: 28px; height: 28px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: bold;
  flex-shrink: 0;
}

.exam-step .step-number { background: #e83e8c; }

.step-icon { font-size: 1.6rem; flex-shrink: 0; }

.step-info { flex: 1; }
.step-title { font-weight: 600; font-size: 0.95rem; }

.step-badge {
  display: inline-block;
  background: #e83e8c;
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-top: 3px;
}

.step-arrow { color: var(--gray); font-size: 1.4rem; }

.games-flow-bottom {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.games-flow-bottom .btn { flex: 1; min-width: 130px; }

/* ===================== EXAM ===================== */
.exam-wrapper { max-width: 700px; margin: 0 auto; }
.exam-title { color: var(--primary); margin-bottom: 8px; font-size: 1.2rem; }
.exam-instruction { color: var(--gray); margin-bottom: 20px; font-size: 0.9rem; }

.exam-questions { display: flex; flex-direction: column; gap: 20px; margin-bottom: 20px; }

.exam-question {
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.exam-q-num {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.exam-q-text {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 14px;
  line-height: 1.5;
}

.exam-options { display: flex; flex-direction: column; gap: 8px; }

.exam-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.exam-option:hover { background: #e7f1ff; border-color: var(--primary); }
.exam-option input[type="radio"] { width: 16px; height: 16px; flex-shrink: 0; }

.exam-option-letter {
  width: 24px; height: 24px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: bold;
  flex-shrink: 0;
}

/* Exam Results */
.exam-results { max-width: 700px; margin: 0 auto; }
.exam-review { margin-top: 24px; }
.exam-review h3 { color: var(--primary); margin-bottom: 14px; }

.review-item {
  padding: 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.review-item.correct { background: var(--success-bg); border-color: var(--success); }
.review-item.incorrect { background: var(--danger-bg); border-color: var(--danger); }

.review-q { font-weight: 600; margin-bottom: 8px; font-size: 0.9rem; }
.review-answer { font-size: 0.85rem; line-height: 1.6; }
.review-exp { color: #856404; background: #fff3cd; padding: 6px 10px; border-radius: 4px; font-size: 0.8rem; margin-top: 6px; }

.correct-icon { color: var(--success); }
.wrong-icon { color: var(--danger); }

/* ===================== FEEDBACK ===================== */
.feedback {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  text-align: center;
  font-weight: 600;
  margin-top: 12px;
  animation: slideDown 0.2s ease;
  font-size: 0.9rem;
}

.feedback.success { background: var(--success-bg); color: var(--success-text); border: 2px solid var(--success); }
.feedback.error { background: var(--danger-bg); color: var(--danger-text); border: 2px solid var(--danger); }

/* ===================== ERROR / LOADING ===================== */
.error-message {
  background: var(--danger-bg); color: var(--danger-text);
  padding: 16px; border-radius: var(--radius-sm);
  border: 1px solid #f5c6cb; text-align: center;
}

.loading-text { text-align: center; color: var(--gray); padding: 40px; font-size: 1rem; }

/* ===================== RESULTS ===================== */
.results-screen { text-align: center; padding: 16px 0; }
.result-emoji { font-size: 64px; margin: 12px 0; line-height: 1; }
.result-score { color: var(--primary); font-size: 1.3rem; margin-bottom: 10px; }
.result-percentage { font-size: 2.8rem; font-weight: bold; color: var(--primary); margin: 10px 0; }
.result-message { font-size: 0.95rem; color: var(--gray); margin: 12px 0 20px; line-height: 1.5; }

.result-actions {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}

.result-actions .btn { flex: 1; min-width: 130px; max-width: 200px; }

/* ===================== QUIZ ===================== */
.game-container { max-width: 700px; margin: 0 auto; }
.game-title { color: var(--primary); margin-bottom: 14px; font-size: 1.2rem; }
.game-question { color: var(--gray); text-align: center; margin-bottom: 14px; font-size: 0.95rem; line-height: 1.5; }
.game-instruction { color: var(--gray); text-align: center; margin-bottom: 14px; font-size: 0.85rem; font-style: italic; }
.game-hint { color: #856404; background: #fff3cd; border: 1px solid var(--warning); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; font-size: 0.85rem; }

.question {
  font-size: 1.05rem; font-weight: 600; color: var(--dark);
  margin-bottom: 18px; line-height: 1.6;
  padding: 14px; background: var(--light);
  border-radius: var(--radius-sm);
  border-right: 4px solid var(--primary);
}

[dir="ltr"] .question { border-right: none; border-left: 4px solid var(--primary); }

.options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }

.option {
  background: var(--light); border: 2px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  cursor: pointer; transition: all 0.2s ease;
  display: flex; align-items: center; gap: 10px;
  font-size: 0.9rem; min-height: 50px;
  user-select: none;
}

.option:hover, .option:focus { background: #e7f1ff; border-color: var(--primary); outline: none; }
.option:active { transform: scale(0.98); }
.option.correct { background: var(--success-bg); border-color: var(--success); color: var(--success-text); }
.option.wrong { background: var(--danger-bg); border-color: var(--danger); color: var(--danger-text); }

.option-letter {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: bold; flex-shrink: 0;
}

.option.correct .option-letter { background: var(--success); }
.option.wrong .option-letter { background: var(--danger); }

/* ===================== FLASHCARDS ===================== */
.flashcard {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--white); padding: 36px 20px;
  border-radius: var(--radius); text-align: center;
  cursor: pointer; min-height: 170px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  margin: 14px 0; transition: transform 0.2s ease;
  user-select: none; box-shadow: var(--shadow);
}

.flashcard:hover { transform: scale(1.01); }
.flashcard:active { transform: scale(0.99); }
.flashcard.back { background: linear-gradient(135deg, #11998e, #38ef7d); }

.flashcard-side-label { font-size: 0.7rem; opacity: 0.8; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.flashcard-text { font-size: 1.05rem; font-weight: 600; line-height: 1.6; }
.tap-hint { text-align: center; color: var(--gray); font-size: 0.8rem; margin-bottom: 10px; }

.card-nav { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.card-nav .btn { flex: 1; min-width: 110px; max-width: 170px; }
.card-nav .btn:disabled { background: #ccc; cursor: not-allowed; opacity: 0.6; }

.completion-message {
  background: #e7f3ff; border: 1px solid var(--primary);
  border-radius: var(--radius-sm); padding: 14px; margin: 10px 0;
  text-align: center; color: var(--primary); font-weight: 600;
}

/* ===================== MATCH GAME ===================== */
.match-container { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.match-column { display: flex; flex-direction: column; gap: 8px; }

.match-column-header {
  font-weight: 700; color: var(--primary); text-align: center;
  padding: 7px; background: var(--light); border-radius: var(--radius-sm); font-size: 0.85rem;
}

.match-item {
  background: var(--light); border: 2px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 8px;
  text-align: center; cursor: pointer; transition: all 0.2s ease;
  font-size: 0.85rem; min-height: 50px;
  display: flex; align-items: center; justify-content: center;
  user-select: none; line-height: 1.4;
}

.match-item:hover:not(.matched), .match-item:focus:not(.matched) { background: #e7f1ff; border-color: var(--primary); outline: none; }
.match-item.selected { background: var(--primary); color: var(--white); border-color: var(--primary); transform: scale(1.03); }
.match-item.matched { background: var(--success-bg); border-color: var(--success); color: var(--success-text); cursor: default; opacity: 0.75; }

/* ===================== SORT GAME ===================== */
.sort-container { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }

.sort-item {
  background: var(--light); border: 2px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  cursor: grab; transition: all 0.2s ease;
  display: flex; align-items: center; gap: 10px;
  font-size: 0.9rem; min-height: 50px;
  user-select: none;
}

.sort-item:hover { background: #e7f1ff; border-color: var(--primary); }
.sort-item.dragging { opacity: 0.5; cursor: grabbing; }
.sort-item.drag-over { background: #e7f1ff; border-color: var(--primary); border-style: dashed; transform: scale(1.02); }

.sort-handle { color: var(--gray); font-size: 1.1rem; flex-shrink: 0; }
.sort-num { width: 22px; height: 22px; background: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: bold; flex-shrink: 0; }

/* ===================== DRAG & DROP ===================== */
.dragdrop-available, .dragdrop-zone { margin-bottom: 14px; }
.zone-label { color: var(--primary); margin-bottom: 6px; font-size: 0.95rem; font-weight: 700; }

.drop-zone {
  min-height: 56px; border: 2px dashed var(--border);
  border-radius: var(--radius-sm); padding: 10px;
  display: flex; flex-wrap: wrap; gap: 8px;
  align-items: flex-start; background: var(--light);
  transition: border-color 0.2s ease;
}

.drop-zone:hover, .drop-zone.drag-over { border-color: var(--primary); background: #e7f1ff; }

.draggable {
  background: var(--primary); color: var(--white);
  padding: 7px 13px; border-radius: 18px;
  cursor: grab; font-size: 0.82rem; font-weight: 600;
  transition: all 0.2s ease; user-select: none; touch-action: none;
}

.draggable:hover { opacity: 0.9; transform: scale(1.03); }
.draggable:active { cursor: grabbing; opacity: 0.7; }
.draggable.dragging { opacity: 0.4; }
.draggable.placed { background: var(--secondary); }

/* ===================== BUILD GAME ===================== */
.equation-display {
  background: var(--light); border: 2px solid var(--border);
  border-radius: var(--radius-sm); padding: 18px;
  text-align: center; font-size: 1.2rem; font-weight: bold;
  min-height: 64px; margin: 14px 0; color: var(--dark);
  letter-spacing: 1px; word-break: break-all;
}

.placeholder { color: #aaa; font-weight: normal; font-size: 0.95rem; }
.element-bank { margin: 14px 0; }
.elements-label { color: var(--gray); margin-bottom: 8px; font-size: 0.85rem; }
.elements-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.element-btn {
  background: var(--primary); color: var(--white);
  border: none; padding: 8px 14px; border-radius: 18px;
  cursor: pointer; font-size: 0.85rem; font-weight: 600;
  font-family: var(--font); transition: all 0.2s ease; min-height: 40px;
  touch-action: manipulation;
}

.element-btn:hover { background: var(--primary-dark); transform: scale(1.05); }
.element-btn:active { transform: scale(0.97); }

.build-actions { display: flex; gap: 10px; margin-top: 14px; }
.build-actions .btn { flex: 1; }

/* ===================== LESSON CONTENT ===================== */
.lesson-content-wrapper { max-width: 860px; margin: 0 auto; }

.lesson-content-header { text-align: center; margin-bottom: 24px; }
.lesson-content-title { color: var(--primary); font-size: clamp(1.1rem, 3.5vw, 1.6rem); margin: 12px 0 6px; }
.lesson-content-teacher { color: var(--gray); font-size: 0.95rem; }

.lesson-content-full {
  background: var(--white); padding: 24px;
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  margin-bottom: 24px; line-height: 1.8; color: var(--dark); font-size: 0.95rem;
}

.lesson-content-full h2 { color: var(--primary); margin-top: 0; margin-bottom: 14px; font-size: 1.3rem; }
.lesson-content-full h3 { color: var(--primary); margin-top: 20px; margin-bottom: 10px; font-size: 1.1rem; }
.lesson-content-full h4 { color: var(--primary-dark); margin-top: 16px; margin-bottom: 8px; font-size: 1rem; }
.lesson-content-full h5 { color: var(--primary-dark); margin-top: 12px; margin-bottom: 6px; font-size: 0.95rem; }
.lesson-content-full p { margin-bottom: 12px; }
.lesson-content-full ul, .lesson-content-full ol { margin: 10px 0; padding-right: 22px; }
[dir="ltr"] .lesson-content-full ul, [dir="ltr"] .lesson-content-full ol { padding-right: 0; padding-left: 22px; }
.lesson-content-full li { margin-bottom: 7px; line-height: 1.6; }
.lesson-content-full strong { color: var(--primary); font-weight: 700; }

.content-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.85rem; }
.content-table th { background: var(--primary); color: white; padding: 8px 10px; text-align: right; }
[dir="ltr"] .content-table th { text-align: left; }
.content-table td { padding: 8px 10px; border: 1px solid var(--border); }
.content-table tr:nth-child(even) td { background: var(--light); }

.definition-box {
  background: #e7f3ff; padding: 12px 14px;
  border-radius: var(--radius-sm); border-right: 4px solid var(--primary);
  margin: 12px 0; font-size: 0.9rem;
}

[dir="ltr"] .definition-box { border-right: none; border-left: 4px solid var(--primary); }

.equation-box {
  background: #f0f0f0; padding: 14px;
  border-radius: var(--radius-sm); text-align: center;
  font-size: 1.1rem; font-weight: bold; margin: 12px 0; letter-spacing: 1px;
}

.tip-box {
  background: #e7f3ff; border: 1px solid var(--primary);
  border-radius: var(--radius-sm); padding: 12px 14px;
  margin-top: 16px; font-size: 0.9rem; color: var(--primary-dark);
}

/* Memory Tips */
.memory-tips { background: #fff8e1; border: 1px solid var(--warning); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.memory-tips h3 { color: #856404; margin-bottom: 14px; }

.tip-card {
  background: white; border-radius: var(--radius-sm);
  padding: 12px 14px; margin-bottom: 10px;
  border-right: 3px solid var(--warning); font-size: 0.9rem;
}

[dir="ltr"] .tip-card { border-right: none; border-left: 3px solid var(--warning); }
.tip-card h4 { color: #856404; margin-bottom: 6px; font-size: 0.9rem; }

/* Content bottom nav */
.content-bottom-nav {
  display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap;
}

.content-bottom-nav .btn { flex: 1; min-width: 130px; }

/* ===================== VIDEOS ===================== */
.videos-section { margin-bottom: 24px; }
.videos-title { color: var(--primary); margin-bottom: 14px; text-align: center; font-size: 1.1rem; }
.videos-grid { display: grid; gap: 16px; }

.video-card {
  background: var(--white); padding: 16px;
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}

.video-title { color: var(--primary); margin-bottom: 6px; font-size: 0.95rem; }
.video-desc { color: var(--gray); margin-bottom: 12px; font-size: 0.8rem; }

.video-wrapper {
  position: relative; padding-bottom: 56.25%; height: 0;
  overflow: hidden; border-radius: var(--radius-sm); background: #000;
}

.video-wrapper iframe {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%; border: none;
}

/* ===================== ANIMATIONS ===================== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 600px) {
  body { padding: 6px; }
  .container { padding: 6px; }
  #content { padding: 14px; }
  .header { padding: 10px 14px; }
  .lessons-grid { grid-template-columns: 1fr; }
  .match-container { grid-template-columns: 1fr; }
  .result-actions { flex-direction: column; align-items: center; }
  .result-actions .btn { width: 100%; max-width: 100%; }
  .modal-content { margin: 2% auto; padding: 16px 14px; }
  .lesson-content-full { padding: 14px; }
  .flashcard { padding: 24px 14px; min-height: 140px; }
  .build-actions { flex-direction: column; }
  .games-flow-bottom { flex-direction: column; }
  .top-nav { flex-wrap: wrap; }
}

/* Android standalone mode */
@media screen and (display-mode: standalone) {
  body { padding-top: max(env(safe-area-inset-top), 12px); padding-bottom: max(env(safe-area-inset-bottom), 12px); }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
  .btn, .option, .match-item, .game-card, .lesson-card, .game-step { min-height: 48px; }
  .draggable { padding: 10px 16px; }
}

/* ===================== MIKA ACADEMY VISIBLE VISITOR COUNTER ===================== */

.visitor-counter-card {
  max-width: 620px;
  margin: 0 auto 24px;
  padding: 18px 20px;
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(102, 126, 234, 0.16), transparent 34%),
    linear-gradient(135deg, #ffffff, #f7f8ff);
  border: 1px solid rgba(102, 126, 234, 0.22);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.10);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.visitor-counter-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    120deg,
    transparent,
    rgba(255, 255, 255, 0.65),
    transparent
  );
  transform: translateX(-100%);
  animation: mikaCounterShine 4.5s infinite;
}

@keyframes mikaCounterShine {
  0% {
    transform: translateX(-100%);
  }

  45% {
    transform: translateX(100%);
  }

  100% {
    transform: translateX(100%);
  }
}

.visitor-counter-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.visitor-counter-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  font-size: 1.55rem;
  box-shadow: 0 8px 22px rgba(102, 126, 234, 0.30);
  flex-shrink: 0;
}

.visitor-counter-title {
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--dark);
  line-height: 1.3;
}

.visitor-counter-subtitle {
  font-size: 0.88rem;
  color: var(--gray);
  margin-top: 2px;
}

.visitor-counter-badge-wrap {
  position: relative;
  z-index: 1;
  margin: 10px 0 8px;
}

.visitor-counter-img {
  display: inline-block;
  max-width: 100%;
  min-height: 28px;
  border-radius: 8px;
}

.visitor-counter-note {
  position: relative;
  z-index: 1;
  display: inline-block;
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(102, 126, 234, 0.10);
  color: #5f5f7a;
  font-size: 0.82rem;
  font-weight: 700;
}

/* تحسين شكل العداد على الموبايل */
@media (max-width: 600px) {
  .visitor-counter-card {
    margin: 0 0 22px;
    padding: 16px 12px;
    border-radius: 18px;
  }

  .visitor-counter-top {
    gap: 10px;
  }

  .visitor-counter-icon {
    width: 42px;
    height: 42px;
    font-size: 1.35rem;
    border-radius: 14px;
  }

  .visitor-counter-title {
    font-size: 1rem;
  }

  .visitor-counter-subtitle {
    font-size: 0.78rem;
  }

  .visitor-counter-note {
    font-size: 0.74rem;
  }
}

