* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: #f4f6f9;
  color: #333;
  display: flex;
  justify-content: center;
  padding: 15px;
}

.app-container {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.streak-badge {
  font-weight: bold;
  color: #ff5722;
  font-size: 15px;
}

.lesson-selector select {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-size: 14px;
  outline: none;
  background: #fff;
}

/* Tab Switch Mode */
.mode-switch {
  display: flex;
  background: #e0e0e0;
  border-radius: 10px;
  padding: 3px;
}

.mode-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  color: #666;
  transition: all 0.2s;
}

.mode-btn.active {
  background: #fff;
  color: #007bff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Quick Actions */
.quick-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.action-btn {
  flex: 1;
  padding: 8px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s;
}

/* Flashcard 3D */
.card-wrapper {
  perspective: 1000px;
  height: 260px;
  cursor: pointer;
}

.card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.card.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  text-align: center;
}

.card-front {
  border: 2px solid #eef2f5;
}

.card-back {
  transform: rotateY(180deg);
  background: #f8faff;
  border: 2px solid #007bff;
}

.card-hint {
  font-size: 11px;
  color: #aaa;
  position: absolute;
  top: 12px;
}

.card-term {
  font-size: 32px;
  font-weight: bold;
  color: #2c3e50;
  margin-bottom: 15px;
}

.card-def {
  font-size: 22px;
  font-weight: bold;
  color: #007bff;
  margin-bottom: 10px;
}

.card-ex {
  font-size: 14px;
  color: #555;
  font-style: italic;
}

.audio-btn {
  background: #eef5ff;
  color: #007bff;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* Card Navigation */
.card-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
}

.nav-btn {
  padding: 10px 20px;
  border: none;
  background: #007bff;
  color: #fff;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
}

.progress-indicator {
  font-weight: bold;
  color: #777;
}

/* Quiz UI */
.quiz-card {
  background: #fff;
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  font-weight: bold;
}

.quiz-score {
  color: #28a745;
}

.quiz-question {
  font-size: 28px;
  font-weight: bold;
  text-align: center;
  margin: 15px 0 20px;
  color: #2c3e50;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-feedback {
  text-align: center;
  font-weight: bold;
  margin-top: 15px;
  min-height: 24px;
}

.primary-btn {
  width: 100%;
  padding: 12px;
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  font-size: 15px;
  margin-top: 15px;
  cursor: pointer;
}

.action-btn.active-autoplay {
  background: #28a745 !important;
  color: #fff !important;
  border-color: #28a745 !important;
  animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(40, 167, 69, 0); }
  100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}
/* ==========================================
   CÁC TÍNH NĂNG GIẢNG DẠY MỚI
   ========================================== */

/* Thanh công cụ giảng dạy */
.teaching-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tool-btn {
  flex: 1;
  padding: 6px 10px;
  background: #e9ecef;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
}

.tool-btn.focus-btn {
  background: #6f42c1;
  color: #fff;
  border-color: #5a32a3;
}

/* Hiệu ứng che chữ */
.masked {
  filter: blur(8px);
  user-select: none;
  opacity: 0.3;
}

/* Đếm ngược Quiz */
.timer-badge {
  font-weight: bold;
  color: #dc3545;
  font-size: 16px;
  background: #ffe3e3;
  padding: 4px 10px;
  border-radius: 12px;
}

/* Chế độ Trình chiếu Toàn màn hình */
:fullscreen .app-container, :-webkit-full-screen .app-container {
  max-width: 100vw;
  height: 100vh;
  justify-content: center;
  padding: 40px;
  background: #f4f6f9;
}

:fullscreen .card-wrapper, :-webkit-full-screen .card-wrapper {
  height: 50vh;
}

:fullscreen .card-term, :-webkit-full-screen .card-term {
  font-size: 72px;
}

:fullscreen .card-def, :-webkit-full-screen .card-def {
  font-size: 48px;
}
/* ==========================================
   FOOTER & MODAL CHÍNH SÁCH
   ========================================== */
.main-footer {
  margin-top: 30px;
  padding: 15px;
  text-align: center;
  font-size: 13px;
  color: #666;
  border-top: 1px solid #e0e0e0;
}

.footer-links a {
  color: #007bff;
  text-decoration: none;
  margin: 0 5px;
  font-weight: 500;
}

.footer-links a:hover {
  text-decoration: underline;
}

.copyright {
  margin-top: 8px;
  font-size: 11px;
  color: #888;
}

/* Modal Popup Overlay */
.info-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s;
}

/* Nội dung Modal */
.modal-content {
  background-color: #fff;
  margin: 10% auto;
  padding: 25px;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  position: relative;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  max-height: 80vh;
  overflow-y: auto;
  line-height: 1.6;
  font-size: 14px;
}

.modal-content h2 {
  color: #007bff;
  margin-bottom: 15px;
  font-size: 20px;
}

.modal-content ul {
  margin-left: 20px;
  margin-top: 10px;
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 24px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
}

.close-btn:hover {
  color: #000;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
/* ==========================================
   CỐ ĐỊNH FOOTER Ở ĐÁY TRANG WEB
   ========================================== */
.main-footer {
  width: 100%;
  max-width: 800px;
  margin: 40px auto 20px auto;
  padding: 20px 0 10px 0;
  text-align: center;
  font-size: 13px;
  color: #666;
  border-top: 1px solid #e0e0e0;
  clear: both;
}

.footer-links a {
  color: #007bff;
  text-decoration: none;
  margin: 0 8px;
  font-weight: 500;
}

.footer-links a:hover {
  text-decoration: underline;
}

.copyright {
  margin-top: 8px;
  font-size: 12px;
  color: #888;
}
/* ==========================================
   CẤU TRÚC CANH GIỮA TRANG WEB & FOOTER ĐÁY TRANG
   ========================================== */
body {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  min-height: 100vh;
  margin: 0;
  padding: 20px 10px;
  box-sizing: border-box;
}

.app-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.main-footer {
  width: 100%;
  max-width: 600px;
  margin: 40px auto 10px auto;
  padding-top: 15px;
  text-align: center;
  font-size: 13px;
  color: #666;
  border-top: 1px solid #e0e0e0;
}

.footer-links a {
  color: #007bff;
  text-decoration: none;
  margin: 0 6px;
  font-weight: 500;
}

.footer-links a:hover {
  text-decoration: underline;
}

.copyright {
  margin-top: 6px;
  font-size: 11px;
  color: #888;
}

/* Modal Popup Overlay */
.info-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: #fff;
  margin: 10% auto;
  padding: 25px;
  border-radius: 12px;
  width: 90%;
  max-width: 450px;
  position: relative;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  line-height: 1.6;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
}