/* ==================== Reset & Base Styles ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: #121212;
  color: #e0e0e0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==================== Utility Classes ==================== */
.hidden {
  display: none !important;
}

/* Touch-friendly interactions */
button,
input[type="file"] + label,
.book-card,
.session-btn,
.continue-study-btn {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  user-select: none;
}

/* Ensure book cards are touch-friendly on mobile */
.book-card:active {
  transform: scale(0.98);
}

.session-btn:active,
.continue-study-btn:active {
  transform: scale(0.97);
}

/* Scrollbar styling for webkit browsers */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1e1e1e;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ==================== Upload Section ==================== */
.upload-section {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.5s ease-out;
}

.upload-container {
  text-align: center;
  max-width: 550px;
  width: 100%;
  padding: 0 10px;
}

@media (max-width: 480px) {
  .upload-container {
    padding: 0 8px;
  }
}

.title-with-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}

.title {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #00c986, #00a870);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0;
  animation: slideDown 0.6s ease-out;
}

.info-btn {
  background: transparent;
  border: 2px solid #00c986;
  color: #00c986;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
  animation: slideDown 0.6s ease-out;
}

.info-btn:hover {
  background: rgba(0, 201, 134, 0.1);
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(0, 201, 134, 0.3);
}

.info-btn svg {
  width: 20px;
  height: 20px;
}

.subtitle {
  font-size: 1rem;
  color: #9e9e9e;
  margin-bottom: 40px;
  animation: slideDown 0.7s ease-out;
}

.upload-box {
  background: #1e1e1e;
  border: 2px dashed #333;
  border-radius: 20px;
  padding: 60px 40px;
  transition: all 0.3s ease;
  animation: slideUp 0.8s ease-out;
}

.upload-box:hover {
  border-color: #00c986;
  box-shadow: 0 0 30px rgba(0, 201, 134, 0.15);
}

.file-input {
  display: none;
}

.file-label {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.file-label svg {
  color: #00c986;
  transition: transform 0.3s ease;
}

.upload-box:hover .file-label svg {
  transform: translateY(-5px);
}

.file-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e0e0e0;
}

.file-hint {
  font-size: 0.85rem;
  color: #757575;
}

/* Book Selection Section */
.book-selection-section {
  margin: 30px 0;
  animation: slideDown 0.7s ease-out;
}

.book-section-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: #e0e0e0;
  margin-bottom: 20px;
  text-align: center;
}

.books-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

/* Ensure book cards don't overflow on small screens */
@media (max-width: 320px) {
  .books-container {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.book-card {
  background: linear-gradient(135deg, #1e1e1e, #252525);
  border: 2px solid #333;
  border-radius: 16px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.book-card:hover {
  transform: translateY(-4px);
  border-color: #00c986;
  box-shadow: 0 8px 24px rgba(0, 201, 134, 0.2);
}

/* Disable hover effects on touch devices */
@media (hover: none) {
  .book-card:hover {
    transform: none;
  }

  .book-card:active {
    transform: scale(0.98);
    border-color: #00c986;
  }
}

.book-card-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.book-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #e0e0e0;
  margin-bottom: 8px;
}

.book-card-sessions {
  font-size: 0.9rem;
  color: #9e9e9e;
}

/* Loading states */
.books-loading,
.sessions-loading {
  text-align: center;
  padding: 40px 20px;
  color: #9e9e9e;
  font-size: 1rem;
}

.books-error {
  text-align: center;
  padding: 40px 20px;
  color: #ff5252;
  font-size: 1rem;
}

/* Loading spinner animation */
.books-loading::after,
.sessions-loading::after {
  content: "...";
  animation: loadingDots 1.5s steps(4, end) infinite;
}

@keyframes loadingDots {
  0%,
  20% {
    content: ".";
  }
  40% {
    content: "..";
  }
  60%,
  100% {
    content: "...";
  }
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 30px 0;
  color: #9e9e9e;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid #333;
}

.divider span {
  padding: 0 20px;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Book Session Modal */
.book-session-modal-content {
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
}

.book-session-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.continue-study-section {
  background: linear-gradient(
    135deg,
    rgba(0, 201, 134, 0.1),
    rgba(0, 168, 107, 0.05)
  );
  border: 2px solid #00c986;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 10px;
}

.continue-study-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #00c986;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.continue-study-info {
  font-size: 0.9rem;
  color: #9e9e9e;
  margin-bottom: 16px;
  line-height: 1.5;
}

.continue-study-btn {
  width: 100%;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #00c986, #00a870);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 201, 134, 0.3);
}

.continue-study-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 201, 134, 0.4);
}

.sessions-section {
  margin-top: 10px;
}

.sessions-title {
  font-size: 1rem;
  font-weight: 600;
  color: #e0e0e0;
  margin-bottom: 16px;
}

.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

/* Ensure sessions grid works on very small screens */
@media (max-width: 320px) {
  .sessions-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .session-btn {
    padding: 10px 8px;
    font-size: 0.75rem;
  }
}

.session-btn {
  padding: 16px 20px;
  font-size: 1rem;
  font-weight: 600;
  background: #2a2a2a;
  color: #e0e0e0;
  border: 2px solid #333;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.session-btn:hover {
  transform: translateY(-2px);
  border-color: #00c986;
  box-shadow: 0 4px 12px rgba(0, 201, 134, 0.2);
  background: rgba(0, 201, 134, 0.1);
}

.session-btn.completed {
  border-color: #00c986;
  background: rgba(0, 201, 134, 0.15);
  color: #00c986;
}

.session-btn.in-progress {
  border-color: #ffcc00;
  background: rgba(255, 204, 0, 0.15);
  color: #ffcc00;
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
  .modal {
    padding: 10px;
  }

  .book-session-modal-content {
    border-radius: 16px;
  }

  /* Ensure modals are scrollable on mobile */
  .book-session-content {
    max-height: calc(90vh - 100px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Better spacing for small screens */
  .upload-section {
    padding: 15px;
  }

  .upload-container {
    max-width: 100%;
  }
}

/* Quick Stats on Upload Page */
.quick-stats {
  background: linear-gradient(135deg, #1e1e1e, #252525);
  border: 1px solid #333;
  border-radius: 20px;
  padding: 24px;
  margin: 30px 0;
  animation: slideDown 0.7s ease-out;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.quick-stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.quick-stats-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e0e0e0;
  margin: 0;
}

.view-full-stats-btn {
  background: transparent;
  border: 1px solid #444;
  color: #9e9e9e;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
}

.view-full-stats-btn:hover {
  background: rgba(0, 201, 134, 0.1);
  border-color: #00c986;
  color: #00c986;
  transform: translateX(2px);
}

.quick-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.quick-stat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #2a2a2a;
  border-radius: 12px;
  border: 1px solid #333;
  transition: all 0.3s ease;
}

.quick-stat-item:hover {
  transform: translateY(-2px);
  border-color: #00c986;
  box-shadow: 0 4px 12px rgba(0, 201, 134, 0.2);
}

.quick-stat-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.quick-stat-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.quick-stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  background: linear-gradient(135deg, #00c986, #ffcc00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.quick-stat-label {
  font-size: 0.75rem;
  color: #9e9e9e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-top: 4px;
}

/* ==================== Flashcard Section ==================== */
.flashcard-section {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  animation: fadeIn 0.5s ease-out;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: #1e1e1e;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00c986, #00a870);
  transition: width 0.4s ease;
  box-shadow: 0 0 10px rgba(0, 201, 134, 0.5);
}

.fast-review-badge {
  background: linear-gradient(135deg, #ffcc00, #ffa500);
  color: #1e1e1e;
  padding: 12px 24px;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 10px rgba(255, 204, 0, 0.4);
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%,
  100% {
    box-shadow: 0 2px 10px rgba(255, 204, 0, 0.4);
  }
  50% {
    box-shadow: 0 2px 20px rgba(255, 204, 0, 0.6);
  }
}

.stats-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 600px;
  width: 100%;
  margin: 30px auto 20px;
  padding: 0 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.stat-item {
  font-size: 0.95rem;
  color: #9e9e9e;
  font-weight: 500;
}

/* Switch Mode Button (Settings Icon) */
.switch-mode-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: linear-gradient(135deg, #00c986, #00a870);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 3px 12px rgba(0, 201, 134, 0.3);
  white-space: nowrap;
  min-width: 44px;
  min-height: 44px;
}

.switch-mode-btn svg {
  transition: transform 0.3s ease;
}

.switch-mode-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 18px rgba(0, 201, 134, 0.4);
  background: linear-gradient(135deg, #00e59a, #00c986);
}

.switch-mode-btn:hover svg {
  transform: rotate(90deg);
}

.switch-mode-btn:active {
  transform: translateY(0);
}

.download-wrongs-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  background: linear-gradient(135deg, #7b68ee, #6a5acd);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 3px 12px rgba(123, 104, 238, 0.3);
  white-space: nowrap;
}

.download-wrongs-btn svg {
  flex-shrink: 0;
}

.download-wrongs-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 18px rgba(123, 104, 238, 0.4);
  background: linear-gradient(135deg, #8a77f8, #7967dd);
}

.download-wrongs-btn:active {
  transform: translateY(0);
}

.download-wrongs-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 3px 12px rgba(123, 104, 238, 0.2);
}

.flashcard-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.flashcard {
  background: #1e1e1e;
  border-radius: 24px;
  padding: 50px 40px;
  max-width: 600px;
  width: 100%;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(0, 201, 134, 0.1);
  animation: cardSlideIn 0.5s ease-out;
}

.word-display {
  text-align: center;
  margin-bottom: 40px;
}

.word-text {
  font-size: 3rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.phonetic-text {
  font-size: 1.1rem;
  color: #ffcc00;
  font-weight: 500;
  font-style: italic;
  min-height: 1.5rem;
}

.answer-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.button-group {
  display: flex;
  gap: 12px;
}

.answer-input {
  width: 100%;
  padding: 18px 24px;
  font-size: 1.1rem;
  background: #2a2a2a;
  border: 2px solid #333;
  border-radius: 12px;
  color: #e0e0e0;
  outline: none;
  transition: all 0.3s ease;
  font-family: inherit;
}

.answer-input:focus {
  border-color: #00c986;
  box-shadow: 0 0 20px rgba(0, 201, 134, 0.2);
}

.answer-input::placeholder {
  color: #666;
}

.submit-btn {
  flex: 1;
  padding: 18px 24px;
  font-size: 1.1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #00c986, #00a870);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 201, 134, 0.3);
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 201, 134, 0.4);
}

.submit-btn:active {
  transform: translateY(0);
}

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.show-answer-btn {
  flex: 1;
  padding: 18px 24px;
  font-size: 1.1rem;
  font-weight: 600;
  background: transparent;
  color: #ffcc00;
  border: 2px solid #ffcc00;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.show-answer-btn:hover {
  background: rgba(255, 204, 0, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 204, 0, 0.3);
}

.show-answer-btn:active {
  transform: translateY(0);
}

.show-answer-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.feedback {
  margin-top: 20px;
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  animation: feedbackPop 0.3s ease-out;
}

.feedback.correct {
  background: rgba(0, 201, 134, 0.15);
  color: #00c986;
  border: 2px solid #00c986;
}

.feedback.incorrect {
  background: rgba(255, 82, 82, 0.15);
  color: #ff5252;
  border: 2px solid #ff5252;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.override-btn {
  margin-top: 8px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  background: linear-gradient(135deg, #00c986, #00a870);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 201, 134, 0.3);
}

.override-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 201, 134, 0.4);
}

.override-btn:active {
  transform: translateY(0);
}

.reveal-section {
  margin-top: 30px;
  animation: slideUp 0.4s ease-out;
}

.revealed-answer {
  background: rgba(255, 204, 0, 0.1);
  border: 2px solid #ffcc00;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  text-align: center;
}

.revealed-label {
  font-size: 0.9rem;
  color: #9e9e9e;
  margin-bottom: 8px;
}

.revealed-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffcc00;
  direction: rtl;
}

.self-check-question {
  text-align: center;
  font-size: 1.1rem;
  color: #e0e0e0;
  margin-bottom: 16px;
  font-weight: 500;
}

.self-check-buttons {
  display: flex;
  gap: 12px;
}

.knew-btn,
.didnt-know-btn {
  flex: 1;
  padding: 16px 20px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.knew-btn {
  background: linear-gradient(135deg, #00c986, #00a870);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(0, 201, 134, 0.3);
}

.knew-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 201, 134, 0.4);
}

.didnt-know-btn {
  background: linear-gradient(135deg, #ff5252, #e04040);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(255, 82, 82, 0.3);
}

.didnt-know-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 82, 82, 0.4);
}

/* ==================== Summary Modal ==================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  background: #1e1e1e;
  border-radius: 24px;
  padding: 50px 40px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(0, 201, 134, 0.2);
  animation: modalSlideUp 0.4s ease-out;
}

.modal-title {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 40px;
  background: linear-gradient(135deg, #00c986, #ffcc00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.summary-stats {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 40px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #2a2a2a;
  border-radius: 12px;
  border: 1px solid #333;
}

.summary-label {
  font-size: 1rem;
  color: #9e9e9e;
  font-weight: 500;
}

.summary-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: #00c986;
}

.summary-value.wrong-color {
  color: #ff5252;
}

/* ==================== Fast Review Section ==================== */
.fast-review-section {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 2px solid #333;
}

.fast-review-info {
  text-align: center;
  margin-bottom: 24px;
}

.fast-review-info h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #ffcc00;
  margin-bottom: 12px;
}

.fast-review-info p {
  font-size: 1rem;
  color: #b0b0b0;
  line-height: 1.6;
  word-wrap: break-word;
}

.highlight-wrong {
  color: #ff5252;
  font-weight: 700;
  font-size: 1.1rem;
}

.highlight-correct {
  color: #00c986;
  font-weight: 700;
  font-size: 1.1rem;
}

.button-group-summary {
  display: flex;
  gap: 12px;
  flex-direction: column;
  width: 100%;
}

.fast-review-btn {
  width: 100%;
  padding: 18px 24px;
  font-size: 1.1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #ffcc00, #ffa500);
  color: #1e1e1e;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 204, 0, 0.3);
}

.fast-review-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 204, 0, 0.4);
}

.skip-review-btn {
  width: 100%;
  padding: 16px 24px;
  font-size: 1rem;
  font-weight: 600;
  background: transparent;
  color: #9e9e9e;
  border: 2px solid #444;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.skip-review-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #e0e0e0;
  border-color: #666;
}

.download-summary-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 24px;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #7b68ee, #6a5acd);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(123, 104, 238, 0.3);
}

.download-summary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(123, 104, 238, 0.4);
  background: linear-gradient(135deg, #8a77f8, #7967dd);
}

.download-summary-btn:active {
  transform: translateY(0);
}

.download-summary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 4px 15px rgba(123, 104, 238, 0.2);
}

.download-summary-btn svg {
  flex-shrink: 0;
}

.restart-btn {
  flex: 1;
  padding: 18px 24px;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #00c986, #00a870);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 201, 134, 0.3);
}

.restart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 201, 134, 0.4);
}

#finalButtons.button-group-summary {
  flex-direction: row;
  margin-top: 30px;
  gap: 16px;
}

@media (max-width: 600px) {
  #finalButtons.button-group-summary {
    flex-direction: column;
    gap: 12px;
  }
}

/* ==================== Review Scope Selection Modal ==================== */
.review-scope-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}

.review-all-btn,
.smart-review-btn {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  width: 100%;
  border: 2px solid #333;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  font-family: inherit;
}

.review-all-btn {
  background: linear-gradient(
    135deg,
    rgba(0, 201, 134, 0.1),
    rgba(0, 168, 107, 0.05)
  );
}

.review-all-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(0, 201, 134, 0.2),
    rgba(0, 168, 107, 0.1)
  );
  border-color: #00c986;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 201, 134, 0.3);
}

.smart-review-btn {
  background: linear-gradient(
    135deg,
    rgba(255, 204, 0, 0.1),
    rgba(255, 165, 0, 0.05)
  );
}

.smart-review-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 204, 0, 0.2),
    rgba(255, 165, 0, 0.1)
  );
  border-color: #ffcc00;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 204, 0, 0.3);
}

.review-all-btn:active,
.smart-review-btn:active {
  transform: translateY(0);
}

.btn-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.btn-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #e0e0e0;
}

.btn-subtitle {
  font-size: 0.9rem;
  color: #9e9e9e;
  line-height: 1.4;
}

/* ==================== Mode Selection Modal ==================== */
.mode-modal-content {
  max-width: 600px;
}

.mode-selection-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.mode-description {
  text-align: center;
  font-size: 1.05rem;
  color: #b0b0b0;
  margin: 0;
}

.mode-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mode-option {
  cursor: pointer;
  display: block;
}

.mode-option input[type="radio"] {
  display: none;
}

.mode-option-card {
  background: #2a2a2a;
  border: 2px solid #333;
  border-radius: 16px;
  padding: 24px;
  transition: all 0.3s ease;
  text-align: center;
}

.mode-option input[type="radio"]:checked + .mode-option-card {
  border-color: #00c986;
  background: rgba(0, 201, 134, 0.1);
  box-shadow: 0 0 20px rgba(0, 201, 134, 0.2);
}

.mode-option:hover .mode-option-card {
  border-color: #00c986;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 201, 134, 0.15);
}

.mode-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.mode-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #e0e0e0;
  margin-bottom: 8px;
}

.mode-desc {
  font-size: 0.95rem;
  color: #9e9e9e;
  line-height: 1.4;
}

.start-session-btn {
  width: 100%;
  padding: 18px 24px;
  font-size: 1.1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #00c986, #00a870);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 201, 134, 0.3);
  margin-top: 8px;
}

.start-session-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 201, 134, 0.4);
  background: linear-gradient(135deg, #00e59a, #00c986);
}

.start-session-btn:active {
  transform: translateY(0);
}

/* ==================== Info Modal ==================== */
.info-modal-content {
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.modal-header .modal-title {
  margin-bottom: 0;
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: #9e9e9e;
  font-size: 1.8rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.3s ease;
  padding: 0;
  line-height: 1;
}

.close-modal-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e0e0e0;
}

.info-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.info-section {
  background: #2a2a2a;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #333;
}

.info-subtitle {
  font-size: 1.1rem;
  font-weight: 600;
  color: #00c986;
  margin-bottom: 12px;
}

.format-box,
.example-box {
  background: #1e1e1e;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
}

.format-box code,
.example-box code {
  color: #ffcc00;
  font-family: "Courier New", monospace;
  font-size: 0.95rem;
  line-height: 1.8;
}

.info-note {
  font-size: 0.9rem;
  color: #9e9e9e;
  margin-top: 8px;
  font-style: italic;
}

.prompt-section {
  background: linear-gradient(
    135deg,
    rgba(0, 201, 134, 0.05),
    rgba(255, 204, 0, 0.05)
  );
  border: 1px solid #00c986;
}

.prompt-desc {
  font-size: 0.95rem;
  color: #b0b0b0;
  margin-bottom: 12px;
  line-height: 1.5;
}

.prompt-box {
  background: #1e1e1e;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
  margin-bottom: 16px;
  max-height: 300px;
  overflow-y: auto;
}

.prompt-box pre {
  color: #e0e0e0;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
}

.copy-prompt-btn {
  width: 100%;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #00c986, #00a870);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 201, 134, 0.3);
}

.copy-prompt-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 201, 134, 0.4);
}

.copy-prompt-btn:active {
  transform: translateY(0);
}

/* ==================== Animations ==================== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateX(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes feedbackPop {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
  .book-selection-section {
    margin: 24px 0;
  }

  .book-section-title {
    font-size: 1.1rem;
    margin-bottom: 16px;
  }

  .books-container {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .book-card {
    padding: 20px;
  }

  .book-card-icon {
    font-size: 2.5rem;
  }

  .book-card-title {
    font-size: 1.1rem;
  }

  .book-card-sessions {
    font-size: 0.85rem;
  }

  .divider {
    margin: 24px 0;
  }

  .divider span {
    padding: 0 16px;
    font-size: 0.85rem;
  }

  .book-session-modal-content {
    max-width: 95%;
    max-height: 90vh;
    padding: 20px;
  }

  .continue-study-section {
    padding: 16px;
  }

  .continue-study-title {
    font-size: 1rem;
    margin-bottom: 10px;
  }

  .continue-study-info {
    font-size: 0.85rem;
    margin-bottom: 14px;
  }

  .continue-study-btn {
    padding: 12px 18px;
    font-size: 0.95rem;
  }

  .sessions-section {
    margin-top: 8px;
  }

  .sessions-title {
    font-size: 0.95rem;
    margin-bottom: 12px;
  }

  .sessions-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
  }

  .session-btn {
    padding: 14px 16px;
    font-size: 0.9rem;
  }

  .quick-stats {
    padding: 20px;
    margin: 24px 0;
  }

  .quick-stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .quick-stat-item {
    padding: 14px;
  }

  .quick-stat-icon {
    font-size: 1.6rem;
  }

  .quick-stat-value {
    font-size: 1.2rem;
  }

  .review-all-btn,
  .smart-review-btn {
    padding: 20px;
    gap: 16px;
  }

  .btn-icon {
    font-size: 2rem;
  }

  .btn-title {
    font-size: 1.1rem;
  }

  .btn-subtitle {
    font-size: 0.85rem;
  }

  .pronunciation-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
  }

  .voice-input-btn {
    width: 40px;
    height: 40px;
    right: 10px;
  }

  .input-with-voice .answer-input {
    padding-right: 58px;
  }

  .phonetic-toggle-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .toggle-text {
    display: none;
  }

  .example-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
  }

  .example-modal-content {
    max-width: 90%;
    padding: 30px 20px;
  }

  .example-section {
    padding: 16px;
  }

  .example-text {
    font-size: 0.95rem;
  }

  .example-text-persian {
    font-size: 1rem;
  }

  .mode-modal-content {
    max-width: 90%;
    padding: 40px 30px;
  }

  .mode-icon {
    font-size: 2rem;
  }

  .mode-title {
    font-size: 1.1rem;
  }

  .mode-desc {
    font-size: 0.9rem;
  }

  .title {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 0.95rem;
  }

  .modal-content {
    padding: 40px 30px;
    max-width: 90%;
  }

  .modal-title {
    font-size: 1.8rem;
    margin-bottom: 30px;
  }

  .summary-stats {
    gap: 16px;
  }

  .summary-item {
    padding: 14px 18px;
  }

  .summary-label {
    font-size: 0.95rem;
  }

  .summary-value {
    font-size: 1.2rem;
  }

  .fast-review-section {
    margin-top: 24px;
    padding-top: 24px;
  }

  #finalButtons.button-group-summary {
    margin-top: 24px;
  }

  .word-text {
    font-size: 2.2rem;
  }

  .phonetic-text {
    font-size: 1rem;
  }

  .flashcard {
    padding: 40px 30px;
  }

  .modal-content {
    padding: 40px 30px;
  }

  .upload-box {
    padding: 50px 30px;
  }

  .title-with-info {
    gap: 12px;
  }

  .info-btn {
    width: 36px;
    height: 36px;
  }

  .info-btn svg {
    width: 18px;
    height: 18px;
  }

  .info-modal-content {
    padding: 30px 20px;
    max-width: 90%;
  }

  .modal-header {
    margin-bottom: 20px;
  }

  .modal-title {
    font-size: 1.5rem;
  }

  .info-subtitle {
    font-size: 1rem;
  }

  .prompt-box {
    max-height: 250px;
  }

  .prompt-box pre {
    font-size: 0.8rem;
  }

  .stats-bar {
    justify-content: center;
    flex-wrap: wrap;
  }

  .download-wrongs-btn {
    font-size: 0.85rem;
    padding: 8px 14px;
  }

  .fast-review-badge {
    font-size: 0.9rem;
    padding: 10px 20px;
  }

  .summary-stats {
    gap: 16px;
  }

  .summary-value {
    font-size: 1.2rem;
  }

  .button-group-summary {
    gap: 10px;
  }

  .fast-review-btn,
  .skip-review-btn,
  .download-summary-btn,
  .restart-btn {
    padding: 14px 18px;
    font-size: 0.95rem;
    width: 100%;
  }

  #finalButtons.button-group-summary {
    flex-direction: column;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .book-selection-section {
    margin: 20px 0;
  }

  .book-section-title {
    font-size: 1rem;
    margin-bottom: 14px;
  }

  .books-container {
    gap: 10px;
  }

  .book-card {
    padding: 18px 16px;
    border-radius: 12px;
  }

  .book-card-icon {
    font-size: 2rem;
    margin-bottom: 10px;
  }

  .book-card-title {
    font-size: 1rem;
    margin-bottom: 6px;
  }

  .book-card-sessions {
    font-size: 0.8rem;
  }

  .divider {
    margin: 20px 0;
  }

  .divider span {
    padding: 0 12px;
    font-size: 0.8rem;
  }

  .book-session-modal-content {
    max-width: 98%;
    padding: 16px;
    max-height: 95vh;
  }

  .book-session-content {
    gap: 12px;
  }

  .continue-study-section {
    padding: 14px;
    border-radius: 12px;
  }

  .continue-study-title {
    font-size: 0.95rem;
    margin-bottom: 8px;
  }

  .continue-study-info {
    font-size: 0.8rem;
    margin-bottom: 12px;
    line-height: 1.4;
  }

  .continue-study-info small {
    font-size: 0.75rem;
    display: block;
    margin-top: 4px;
  }

  .continue-study-btn {
    padding: 12px 16px;
    font-size: 0.9rem;
    border-radius: 10px;
  }

  .sessions-section {
    margin-top: 6px;
  }

  .sessions-title {
    font-size: 0.9rem;
    margin-bottom: 10px;
  }

  .sessions-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
  }

  .session-btn {
    padding: 12px 14px;
    font-size: 0.85rem;
    border-radius: 10px;
  }

  .review-all-btn,
  .smart-review-btn {
    padding: 18px;
    gap: 14px;
  }

  .btn-icon {
    font-size: 1.8rem;
  }

  .btn-title {
    font-size: 1rem;
  }

  .btn-subtitle {
    font-size: 0.8rem;
  }

  .pronunciation-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .pronunciation-btn span {
    display: none;
  }

  .voice-input-btn {
    width: 38px;
    height: 38px;
  }

  .input-with-voice .answer-input {
    padding-right: 54px;
  }

  .voice-toast {
    font-size: 0.85rem;
    padding: 10px 20px;
  }

  .phonetic-toggle-btn {
    padding: 8px;
    min-width: 44px;
  }

  .example-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .example-modal-content {
    max-width: 95%;
    padding: 25px 16px;
  }

  .example-lang-label {
    font-size: 0.85rem;
  }

  .example-text {
    font-size: 0.9rem;
  }

  .example-text-persian {
    font-size: 0.95rem;
  }

  .synonyms-text {
    font-size: 0.85rem;
  }

  .mode-modal-content {
    max-width: 95%;
    padding: 30px 20px;
  }

  .mode-description {
    font-size: 0.95rem;
  }

  .mode-option-card {
    padding: 20px;
  }

  .mode-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
  }

  .mode-title {
    font-size: 1rem;
  }

  .mode-desc {
    font-size: 0.85rem;
  }

  .start-session-btn {
    padding: 16px 20px;
    font-size: 1rem;
  }

  body {
    font-size: 14px;
  }

  .title {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.9rem;
    margin-bottom: 30px;
  }

  .modal {
    padding: 15px;
  }

  .modal-content {
    padding: 30px 20px;
    max-width: 95%;
    border-radius: 16px;
  }

  .modal-title {
    font-size: 1.5rem;
    margin-bottom: 24px;
  }

  .summary-stats {
    gap: 12px;
  }

  .summary-item {
    padding: 12px 16px;
    border-radius: 10px;
  }

  .summary-label {
    font-size: 0.9rem;
  }

  .summary-value {
    font-size: 1.1rem;
  }

  .fast-review-section {
    margin-top: 20px;
    padding-top: 20px;
  }

  .fast-review-info {
    margin-bottom: 20px;
  }

  #finalButtons.button-group-summary {
    margin-top: 20px;
  }

  .title-with-info {
    gap: 10px;
  }

  .info-btn {
    width: 32px;
    height: 32px;
  }

  .info-btn svg {
    width: 16px;
    height: 16px;
  }

  .word-text {
    font-size: 1.8rem;
  }

  .phonetic-text {
    font-size: 0.95rem;
  }

  .flashcard {
    padding: 25px 16px;
    border-radius: 16px;
  }

  .word-display {
    margin-bottom: 30px;
  }

  .modal {
    padding: 10px;
  }

  .modal-content {
    padding: 25px 16px;
    border-radius: 16px;
  }

  .modal-title {
    font-size: 1.4rem;
    margin-bottom: 24px;
  }

  .info-modal-content {
    padding: 20px 16px;
    max-width: 95%;
    max-height: 90vh;
  }

  .modal-header {
    margin-bottom: 16px;
  }

  .close-modal-btn {
    width: 32px;
    height: 32px;
    font-size: 1.5rem;
  }

  .info-section {
    padding: 16px;
  }

  .info-subtitle {
    font-size: 0.95rem;
    margin-bottom: 10px;
  }

  .format-box,
  .example-box {
    padding: 12px;
  }

  .format-box code,
  .example-box code {
    font-size: 0.85rem;
  }

  .prompt-desc {
    font-size: 0.85rem;
  }

  .prompt-box {
    padding: 12px;
    max-height: 200px;
  }

  .prompt-box pre {
    font-size: 0.75rem;
    line-height: 1.5;
  }

  .copy-prompt-btn {
    padding: 12px 16px;
    font-size: 0.95rem;
  }

  .upload-box {
    padding: 40px 20px;
    border-radius: 16px;
  }

  .file-label svg {
    width: 40px;
    height: 40px;
  }

  .file-text {
    font-size: 1rem;
  }

  .file-hint {
    font-size: 0.8rem;
  }

  .answer-input,
  .submit-btn,
  .show-answer-btn {
    font-size: 1rem;
    padding: 14px 18px;
    border-radius: 10px;
  }

  .button-group {
    flex-direction: column;
    gap: 10px;
  }

  .self-check-buttons {
    flex-direction: column;
    gap: 10px;
  }

  .knew-btn,
  .didnt-know-btn {
    padding: 14px 18px;
    font-size: 0.95rem;
  }

  .revealed-text {
    font-size: 1.2rem;
  }

  .feedback {
    padding: 12px 18px;
    font-size: 0.95rem;
  }

  .override-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
  }

  .stats-bar {
    padding: 0 10px;
    margin: 20px auto 16px;
  }

  .stat-item {
    font-size: 0.85rem;
  }

  .download-wrongs-btn {
    width: 100%;
    justify-content: center;
    font-size: 0.8rem;
    padding: 8px 12px;
  }

  .download-wrongs-btn svg {
    width: 14px;
    height: 14px;
  }

  .fast-review-badge {
    font-size: 0.8rem;
    padding: 8px 12px;
  }

  .fast-review-info h3 {
    font-size: 1rem;
  }

  .fast-review-info p {
    font-size: 0.85rem;
  }

  .highlight-wrong,
  .highlight-correct {
    display: block;
    margin: 4px 0;
  }

  .summary-item {
    padding: 10px 14px;
  }

  .summary-label {
    font-size: 0.85rem;
  }

  .summary-value {
    font-size: 1rem;
  }

  .restart-btn,
  .download-summary-btn {
    padding: 14px 18px;
    font-size: 0.9rem;
  }

  .fast-review-btn,
  .skip-review-btn {
    padding: 14px 18px;
    font-size: 0.95rem;
  }

  .fast-review-info h3 {
    font-size: 1.1rem;
  }

  .fast-review-info p {
    font-size: 0.9rem;
  }

  .fast-review-badge {
    font-size: 0.85rem;
    padding: 8px 16px;
  }

  .highlight-wrong,
  .highlight-correct {
    font-size: 1rem;
  }
}

/* Extra small devices (phones in portrait, less than 360px) */
@media (max-width: 360px) {
  .book-selection-section {
    margin: 16px 0;
  }

  .book-section-title {
    font-size: 0.95rem;
    margin-bottom: 12px;
  }

  .book-card {
    padding: 16px 12px;
  }

  .book-card-icon {
    font-size: 1.8rem;
  }

  .book-card-title {
    font-size: 0.95rem;
  }

  .book-card-sessions {
    font-size: 0.75rem;
  }

  .book-session-modal-content {
    padding: 14px;
  }

  .continue-study-section {
    padding: 12px;
  }

  .continue-study-title {
    font-size: 0.9rem;
  }

  .continue-study-info {
    font-size: 0.75rem;
  }

  .continue-study-btn {
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  .sessions-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 6px;
  }

  .session-btn {
    padding: 10px 12px;
    font-size: 0.8rem;
  }

  .title {
    font-size: 1.3rem;
  }

  .word-text {
    font-size: 1.5rem;
  }

  .flashcard {
    padding: 20px 12px;
  }

  .modal {
    padding: 10px;
  }

  .modal-content {
    padding: 20px 14px;
    border-radius: 12px;
  }

  .modal-title {
    font-size: 1.3rem;
    margin-bottom: 20px;
  }

  .summary-stats {
    gap: 10px;
  }

  .summary-item {
    padding: 10px 12px;
  }

  .summary-label {
    font-size: 0.8rem;
  }

  .summary-value {
    font-size: 0.95rem;
  }

  .fast-review-section {
    margin-top: 16px;
    padding-top: 16px;
  }

  .fast-review-info h3 {
    font-size: 0.95rem;
  }

  .fast-review-info p {
    font-size: 0.8rem;
  }

  .highlight-wrong,
  .highlight-correct {
    font-size: 0.9rem;
  }

  .fast-review-btn,
  .skip-review-btn,
  .download-summary-btn,
  .restart-btn {
    padding: 12px 16px;
    font-size: 0.85rem;
  }

  #finalButtons.button-group-summary {
    margin-top: 16px;
    gap: 8px;
  }

  .info-modal-content {
    padding: 16px 12px;
  }

  .upload-box {
    padding: 30px 16px;
  }

  .answer-input,
  .submit-btn,
  .show-answer-btn {
    font-size: 0.9rem;
    padding: 12px 16px;
  }

  .stats-bar {
    gap: 8px;
  }

  .stat-item {
    font-size: 0.8rem;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .upload-section,
  .flashcard-section {
    min-height: auto;
    padding: 10px;
  }

  .book-selection-section {
    margin: 16px 0;
  }

  .books-container {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
  }

  .book-card {
    padding: 16px;
  }

  .book-session-modal-content {
    max-height: 95vh;
  }

  .sessions-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }

  .flashcard {
    padding: 20px 16px;
  }

  .word-display {
    margin-bottom: 20px;
  }

  .modal-content,
  .info-modal-content {
    max-height: 95vh;
  }

  .upload-box {
    padding: 30px 20px;
  }

  .file-label svg {
    width: 36px;
    height: 36px;
  }
}

/* Prevent zoom on input focus for iOS */
@supports (-webkit-touch-callout: none) {
  .answer-input {
    font-size: 16px !important;
  }
}

/* Ensure proper scrolling on mobile */
@media (max-width: 768px) {
  body {
    -webkit-overflow-scrolling: touch;
    overflow-x: hidden;
  }

  /* Better modal scrolling */
  .modal-content {
    -webkit-overflow-scrolling: touch;
  }

  /* Fix for iOS safe area */
  @supports (padding: max(0px)) {
    .upload-section,
    .flashcard-section {
      padding-left: max(20px, env(safe-area-inset-left));
      padding-right: max(20px, env(safe-area-inset-right));
    }
  }
}

/* ==================== Pronunciation Button ==================== */
.pronunciation-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  margin: 12px auto 0;
  font-size: 0.9rem;
  font-weight: 600;
  background: linear-gradient(135deg, #7b68ee, #6a5acd);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 3px 12px rgba(123, 104, 238, 0.3);
}

.pronunciation-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 18px rgba(123, 104, 238, 0.4);
  background: linear-gradient(135deg, #8a77f8, #7967dd);
}

.pronunciation-btn:active {
  transform: translateY(0);
}

.pronunciation-btn.pronouncing {
  animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* ==================== Voice Input Button ==================== */
.input-with-voice {
  position: relative;
  width: 100%;
}

.voice-input-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #ff5252, #e04040);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(255, 82, 82, 0.3);
}

.voice-input-btn:hover {
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 4px 15px rgba(255, 82, 82, 0.4);
}

.voice-input-btn:active {
  transform: translateY(-50%) scale(0.98);
}

.voice-input-btn.listening {
  animation: recordingPulse 1s ease-in-out infinite;
  background: linear-gradient(135deg, #ff7070, #ff5252);
}

@keyframes recordingPulse {
  0%,
  100% {
    box-shadow: 0 2px 10px rgba(255, 82, 82, 0.3);
  }
  50% {
    box-shadow:
      0 0 25px rgba(255, 82, 82, 0.6),
      0 0 40px rgba(255, 82, 82, 0.4);
  }
}

.input-with-voice .answer-input {
  padding-right: 64px;
}

/* ==================== Voice Toast ==================== */
.voice-toast {
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #00c986, #00a870);
  color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 201, 134, 0.4);
  font-weight: 600;
  font-size: 0.95rem;
  z-index: 2000;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.voice-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-icon {
  font-size: 1.2rem;
}

/* ==================== Phonetic Toggle Button ==================== */
.phonetic-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  background: #2a2a2a;
  color: #9e9e9e;
  border: 2px solid #333;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.phonetic-toggle-btn:hover {
  border-color: #ffcc00;
  color: #ffcc00;
  transform: translateY(-2px);
}

.phonetic-toggle-btn.active {
  background: linear-gradient(
    135deg,
    rgba(255, 204, 0, 0.15),
    rgba(255, 204, 0, 0.1)
  );
  border-color: #ffcc00;
  color: #ffcc00;
  box-shadow: 0 0 15px rgba(255, 204, 0, 0.2);
}

.toggle-icon {
  font-size: 1.1rem;
}

.toggle-text {
  font-size: 0.85rem;
}

/* ==================== Example Button ==================== */
.example-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  margin-top: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  background: linear-gradient(135deg, #ffcc00, #ffa500);
  color: #1e1e1e;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 3px 12px rgba(255, 204, 0, 0.3);
}

.example-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 18px rgba(255, 204, 0, 0.4);
  background: linear-gradient(135deg, #ffd633, #ffb520);
}

.example-btn:active {
  transform: translateY(0);
}

/* ==================== Example Modal ==================== */
.example-modal-content {
  max-width: 600px;
}

.example-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.example-section {
  background: #2a2a2a;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #333;
}

.example-lang-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffcc00;
  margin-bottom: 12px;
}

.example-text {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #e0e0e0;
  margin: 0;
}

.example-text-persian {
  direction: rtl;
  font-size: 1.1rem;
}

/* ==================== Synonyms Section ==================== */
.synonyms-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #333;
}

.synonyms-label {
  font-size: 0.8rem;
  color: #9e9e9e;
  margin-bottom: 6px;
  font-style: italic;
}

.synonyms-text {
  font-size: 0.9rem;
  color: #7b68ee;
  font-style: italic;
  margin: 0;
}

/* ==================== Card Transition Effects ==================== */
.flashcard.slide-out-left {
  animation: slideOutLeft 0.4s ease-out forwards;
}

.flashcard.slide-out-right {
  animation: slideOutRight 0.4s ease-out forwards;
}

@keyframes slideOutLeft {
  to {
    opacity: 0;
    transform: translateX(-50px) scale(0.95);
  }
}

@keyframes slideOutRight {
  to {
    opacity: 0;
    transform: translateX(50px) scale(0.95);
  }
}

/* ==================== Phase Transition Notification ==================== */
.phase-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: linear-gradient(135deg, #1e1e1e, #2a2a2a);
  border: 2px solid #00c986;
  border-radius: 20px;
  padding: 40px 50px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.8),
    0 0 40px rgba(0, 201, 134, 0.3);
  z-index: 2000;
  text-align: center;
  opacity: 0;
  transition: all 0.3s ease-out;
  max-width: 90%;
}

.phase-notification.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.phase-notification h3 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #00c986, #ffcc00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.phase-notification p {
  font-size: 1.1rem;
  color: #9e9e9e;
  margin: 0;
}

/* ==================== Statistics Dashboard ==================== */

/* Stats Button */
.stats-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: linear-gradient(135deg, #ffcc00, #ffa500);
  color: #1e1e1e;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 3px 12px rgba(255, 204, 0, 0.3);
  min-width: 44px;
  min-height: 44px;
}

.stats-btn svg {
  transition: transform 0.3s ease;
}

.stats-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 18px rgba(255, 204, 0, 0.4);
  background: linear-gradient(135deg, #ffd633, #ffb520);
}

.stats-btn:hover svg {
  transform: scale(1.1);
}

.stats-btn:active {
  transform: translateY(0);
}

/* Stats Modal Content */
.stats-modal-content {
  max-width: 1000px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 40px 30px;
}

.stats-content {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Summary Cards */
.stats-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 10px;
}

.stat-card {
  background: linear-gradient(135deg, #2a2a2a, #252525);
  border: 1px solid #333;
  border-radius: 16px;
  padding: 24px 20px;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 201, 134, 0.15);
  border-color: #00c986;
}

.stat-card-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.stat-card-label {
  font-size: 0.85rem;
  color: #9e9e9e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  font-weight: 600;
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #00c986, #ffcc00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.chart-container {
  background: #2a2a2a;
  border: 1px solid #333;
  border-radius: 16px;
  padding: 20px;
  transition: all 0.3s ease;
}

.chart-container:hover {
  border-color: #00c986;
  box-shadow: 0 4px 16px rgba(0, 201, 134, 0.1);
}

.chart-wide {
  grid-column: 1 / -1;
}

.chart-title {
  font-size: 1rem;
  font-weight: 600;
  color: #e0e0e0;
  margin-bottom: 16px;
  text-align: center;
}

.chart {
  width: 100%;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #1e1e1e;
  border-radius: 12px;
  border: 1px solid #333;
}

.chart svg {
  width: 100%;
  height: 100%;
}

/* Chart Legend */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #e0e0e0;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

/* Stats Actions */
.stats-actions {
  display: flex;
  gap: 16px;
  margin-top: 10px;
}

.export-stats-btn,
.reset-stats-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.export-stats-btn {
  background: linear-gradient(135deg, #00c986, #00a870);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(0, 201, 134, 0.3);
}

.export-stats-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 201, 134, 0.4);
  background: linear-gradient(135deg, #00e59a, #00c986);
}

.export-stats-btn:active {
  transform: translateY(0);
}

.reset-stats-btn {
  background: linear-gradient(135deg, #ff5252, #e04040);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(255, 82, 82, 0.3);
}

.reset-stats-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 82, 82, 0.4);
  background: linear-gradient(135deg, #ff6b6b, #ff5252);
}

.reset-stats-btn:active {
  transform: translateY(0);
}

.export-stats-btn svg,
.reset-stats-btn svg {
  flex-shrink: 0;
}

/* Responsive Stats Dashboard */
@media (max-width: 768px) {
  .stats-modal-content {
    padding: 30px 20px;
    max-width: 95%;
  }

  .stats-summary-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 20px 16px;
  }

  .stat-card-icon {
    font-size: 2rem;
  }

  .stat-card-value {
    font-size: 1.5rem;
  }

  .charts-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .chart {
    height: 160px;
  }

  .stats-actions {
    flex-direction: column;
    gap: 12px;
  }

  .export-stats-btn,
  .reset-stats-btn {
    padding: 14px 20px;
    font-size: 0.95rem;
  }

  .stats-btn {
    padding: 8px;
    min-width: 40px;
    min-height: 40px;
  }
}

@media (max-width: 480px) {
  .stats-modal-content {
    padding: 20px 16px;
  }

  .stats-summary-cards {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 18px 14px;
  }

  .stat-card-label {
    font-size: 0.75rem;
  }

  .stat-card-value {
    font-size: 1.3rem;
  }

  .chart-title {
    font-size: 0.9rem;
  }

  .chart {
    height: 140px;
  }

  .chart-legend {
    gap: 8px;
  }

  .legend-item {
    font-size: 0.75rem;
  }

  .export-stats-btn,
  .reset-stats-btn {
    padding: 12px 18px;
    font-size: 0.9rem;
    gap: 8px;
  }

  .export-stats-btn svg,
  .reset-stats-btn svg {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 768px) {
  .phase-notification {
    padding: 30px 40px;
    border-radius: 16px;
  }

  .phase-notification h3 {
    font-size: 1.5rem;
  }

  .phase-notification p {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .phase-notification {
    padding: 25px 30px;
    border-radius: 12px;
  }

  .phase-notification h3 {
    font-size: 1.3rem;
    margin-bottom: 8px;
  }

  .phase-notification p {
    font-size: 0.9rem;
  }
}

/* ==================== Developer Contact ==================== */
.developer-contact {
  margin-top: 60px;
  padding: 24px 16px;
  text-align: center;
  border-top: 1px solid #333;
  background: linear-gradient(
    135deg,
    rgba(0, 201, 134, 0.04),
    rgba(255, 204, 0, 0.03)
  );
}

.developer-text {
  font-size: 0.95rem;
  color: #9e9e9e;
  margin-bottom: 8px;
}

.developer-name {
  font-weight: 700;
  color: #00c986;
}

.heart {
  display: inline-block;
  animation: heartBeat 1.6s ease-in-out infinite;
}

@keyframes heartBeat {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.25);
  }
}

.developer-email {
  font-size: 0.9rem;
  color: #ffcc00;
  text-decoration: none;
  transition: all 0.3s ease;
}

.developer-email:hover {
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 204, 0, 0.6);
}

/* ==================== Developer Footer ==================== */
.developer-footer {
  margin-top: auto;
  padding: 20px 16px;
  text-align: center;
  border-top: 1px solid #333;
  background: linear-gradient(
    135deg,
    rgba(0, 201, 134, 0.05),
    rgba(255, 204, 0, 0.04)
  );
  width: 100%;
  display: flex;
  flex-direction: column;
}

.developer-footer p {
  font-size: 0.9rem;
  color: #9e9e9e;
  margin-bottom: 6px;
}

.dev-name {
  font-weight: 700;
  color: #00c986;
}

.developer-footer a {
  font-size: 0.85rem;
  color: #ffcc00;
  text-decoration: none;
  transition: all 0.3s ease;
}

.developer-footer a:hover {
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 204, 0, 0.6);
}

.heart {
  display: inline-block;
  animation: heartBeat 1.6s infinite;
}

@keyframes heartBeat {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.25);
  }
}
