/* ================================
   GENERAL LAYOUT & TYPOGRAPHY
================================== */

body {
  font-family: 'Roboto', sans-serif;
  background: linear-gradient(135deg, #f2f2f2 10%, #a6c1ee 90%);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #333333;
  transition: background 0.5s ease, color 0.5s ease;
}

h1, h2 {
  color: #333333;
  margin-bottom: 20px;
  text-shadow: none;
}

.animated-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('assets/lightback.jpg') no-repeat center center;
  background-size: cover;
  transition: background-position 0.1s ease-out;
  z-index: -1;
}

body.dark-mode .animated-background {
  background: url('assets/darkmode.jpg') no-repeat center center;
  background-size: cover;
}

#mute-toggle,
#home-button {
  z-index: 999;
}

/* ================================
   DIAMOND BAR
================================== */
#diamond-bar {
  position: fixed;
  top: 20px;
  right: 20px;
  height: 30px;
  background-color: #fefefec1;
  border: 2px solid #313132;
  color: rgb(53, 43, 43);
  padding: 0 0 0 10px;
  border-radius: 20px;
  font-size: 20px;
  font-weight: bold;
  display: flex;
  align-items: center;
  z-index: 1000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  overflow: visible;
}
.diamond-text {
  padding-right: 0px;
}
.diamond-icon {
  width: 50px;
  height: 50px;
  object-fit: contain;
  display: block;
}
body.dark-mode .diamond-icon {
  filter: invert(1);
}
body.dark-mode #diamond-bar {
  background-color: #333333;
  border: 2px solid #efebeb;
  color: #efebeb;
}
.diamond-icon-wrapper {
  position: relative;
}

/* ================================
   NAV BUTTONS (Home/Mute)
================================== */
#mute-toggle {
  position: fixed;
  bottom: 20px;
  background: none;
  border: none;
  cursor: pointer;
}
#home-button {
  position: fixed;
  top: 20px;
  background: none;
  border: none;
  cursor: pointer;
}
#mute-toggle {
  left: 20px;
}
#home-button {
  left: 20px;
}
body.dark-mode #home-button img,
body.dark-mode #mute-toggle img {
  filter: invert(1);
}

/* ================================
   PAGE TITLE
================================== */
#page-title {
  margin-top: 70px;
  text-align: center;
  font-size: 32px;
}

/* ================================
   LEVEL & SUBJECT SELECT SCREEN
================================== */
#level-select {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px; /* Adds space between title, levels, and button */
}

#levels {
  
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  gap: 30px ;
  justify-items: center;
  margin-top: 20px;
  margin-bottom: 100px;
  width: 100%;
  max-width: 800px;
}
.level-button {
  background: linear-gradient(145deg, #e0e0e0, #ffffff);
  color: #333333;
  font-size: 30px;
  width: 80px;
  height: 80px;
  border-radius: 20%;
  border: 2px solid #ccc;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 5px #ccc;
  transition: background 0.3s, transform 0.2s, box-shadow 0.3s;
}
.level-button:hover {
  background: linear-gradient(145deg, #d0d0d0, #ffffff);
  transform: scale(1.1);
  box-shadow: 0 0 10px #bbb;
}
.level-button:disabled {
  background: #eeeeee;
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}
.lock-icon {
  position: absolute;
  top: -5px;
  right: -5px;
  font-size: 18px;
  color: #666666;
}

/* Subject Buttons */
#subject-select,
#books {
  display: flex;
  flex-direction: row;
  gap: 20px;
  justify-content: center;
  align-items: center;
  margin-top: 30px;
  flex-wrap: wrap;
}
.subject-button {
  background: linear-gradient(145deg, #e0e0e0, #ffffff);
  color: #333333;
  font-size: 20px;
  width: 200px;
  height: 200px;
  border-radius: 20%;
  border: 2px solid #ccc;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.3s, transform 0.2s, box-shadow 0.3s;
  position: relative;
  box-shadow: 0 0 5px #ccc;
  text-align: center;
  padding: 10px;
}
.subject-button:hover {
  background: linear-gradient(145deg, #d0d0d0, #ffffff);
  transform: scale(1.1);
  box-shadow: 0 0 10px #bbb;
}

.long-text {
  font-size: 15px !important;
  line-height: 1.3;
  padding: 8px 10px !important;
}

/* ================================
   FLASHCARDS: GRID, FLIP, STAR
================================== */
.flashcard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  width: 100vw;
  padding: 60px 2vw 24px 2vw;
  min-height: 100vh;
  box-sizing: border-box;
}

.flashcard-flip-container {
  width: 100%;
  height: 150px;
  margin: 0;
  display: block;
  perspective: 1000px;
  position: relative;
  box-sizing: border-box;     /* ADD */
  overflow: visible;          /* Optional */
  animation-name: gentle-wobble;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  transform-origin: center;

}

.flashcard-flip {
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(.75,0,.25,1.1);
  transform-style: preserve-3d;
  position: left;
  cursor: pointer;
}
.flashcard-flip.flipped {
  transform: rotateY(180deg);
}
.flashcard-front, .flashcard-back {
  font-size: 1.5rem;
  padding: 8px 6px;
  border-radius: 18px;
  background: linear-gradient(145deg, #fff 0%, #f9f9f9 100%);
  box-shadow: 0 0 14px #ccc, 0 0 25px #eee;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  user-select: none;
  text-align: center;
  white-space: normal;
  word-break: break-word;
}
.flashcard-back {
  background: linear-gradient(145deg, #e8e7ff 0%, #dedfff 100%);
  color: #6c63ff;
  transform: rotateY(180deg);
}
.flashcard-star {
  position: absolute;
  top: 1px;
  right: 4px;
  font-size: 22px;
  color: #bbb;
  cursor: pointer;
  transition: color 0.2s;
  user-select: none;
  z-index: 2;
}
.flashcard-star:hover {
  transform: scale(1.2);
}

.flashcard-star.hard {
  color: #ffe066;
}


/* DARK MODE for Flashcards */
body.dark-mode .flashcard-front,
body.dark-mode .flashcard-back {
  background: linear-gradient(145deg, #323232 0%, #1a1a1a 100%);
  color: #fff;
  box-shadow: 0 0 5px #ffffff22, 0 0 10px #ffffff11, inset 0 0 5px #000000cc;
  border-radius: 16px;
  border: 2px solid #e7e5e5;
  font-weight: 500;
}
body.dark-mode .flashcard-back {
  background: linear-gradient(145deg, #16163a 0%, #222246 100%);
  color: #f0e7ff;
}
/* RESPONSIVE FLASHCARDS (mobile) */
@media (max-width: 600px) {
  .flashcard-flip-container {
  width: 100%;          /* Make card fill grid column */
  max-width: 300px;     /* Optional: for max size on large screens */
  height: 120px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.flashcard-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 70px 2vw 16px 2vw;
    justify-items: center;
  }
  .flashcard-front, .flashcard-back {
    font-size: 1.5rem;
    padding: 6px 2px;
  }
}

/* ================================
   MULTIPLE CHOICE QUIZ
================================== */
#quiz {
  width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background:linear-gradient(120deg, #a6c1ee 40%, #f2f2f2 100%);
  border-radius: 18px; /* Optional: rounded corners */
  box-shadow: 0 6px 32px #bbb6; /* Optional: drop shadow for "card" effect */
  padding: 32px 0;     /* Optional: spacing inside */
}

body.dark-mode #quiz {
  background: rgba(56, 56, 56, 0.667);
  color: #676768; 
  box-shadow: 0 6px 32px #222a; /* darker drop shadow */
  border-radius: 18px;
}


/* Make sure both question and options are always the same width and centered */
#question-container, #options {
  max-width: 380px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

#question-number {
  font-size: 18px;
  color: #777777;
  text-align: center;
  margin-bottom: 10px;
}

#question-text {
  /* Soft blue gradient background for a modern, uplifting look */
  background: linear-gradient(120deg, #dfdede 0%, #ffffff 60%, #dfdede 100%);  
  color: #223344;               /* Soft dark color for readability */
  padding: 18px 16px;           /* A bit more padding for balance */
  border-radius: 14px;          /* Slightly larger corners for a friendlier feel */
  font-size: 25px;
  font-weight: bold;
  text-align: center;
  min-height: 100px;
  box-shadow: 0 0 15px #ccc;
  border: 2px solid #b7deed;
  width: 100%;
  word-break: break-word; 
  white-space: normal; 
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  margin-bottom: 20px;
}

#options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  width: 100%;
  box-sizing: border-box;
  /* No max-width here! It inherits from above */
}

.option-button {
  background: linear-gradient(145deg, #ffffff 0%, #f2f2f2 100%);
  color: #333333;
  font-size: 20px;
  font-weight: bold;
  padding: 10px;
  width: 100%;
  max-width: 200px;
  height: 100px;
  border: 2px solid #ccc;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 15px #ccc;
}
.option-button:hover {
  background: linear-gradient(145deg, #eeeeee, #ffffff);
  transform: scale(1.05);
  box-shadow: 0 0 15px #ccc;
}
.correct {
  background-color: #ffffff !important;
  color: #28a745 !important;
  border-color: #28a745 !important;
}
.wrong {
  background-color: #ffffff !important;
  color: #dc3545 !important;
  border-color: #dc3545 !important;
}

/* ================================
   TIMER BAR
================================== */
#timer-container {
  width: 100%;
  max-width: 380px;   
  margin: 0 auto 10px auto;
  background-color: #dddddd;
  height: 10px;
  border-radius: 5px;
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
#timer-bar {
  height: 100%;
  width: 100%;
  background-color: #6c63ff;
  transition: width 1s linear, box-shadow 0.5s;
  box-shadow: 0 0 20px #6c63ff, 0 0 40px #6c63ff, 0 0 60px #6c63ff;
}
.red-flash {
  animation: flashRed 0.5s infinite alternate;
}
@keyframes flashRed {
  from {
    background-color: #ff0000;
    box-shadow: 0 0 20px #ff0000, 0 0 40px #ff0000, 0 0 60px #ff0000;
  }
  to {
    background-color: #ff9999;
    box-shadow: 0 0 20px #ff9999, 0 0 40px #ff9999, 0 0 60px #ff9999;
  }
}

/* ================================
   MATCHING QUIZ (SLIDER & LAYOUT)
================================== */
/* Container for the whole quiz */
#matching-quiz {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 95%;
}


/* No need for a horizontal slider, so keep it simple */
#slider-container {
  width: 100%;
  overflow: visible; /* No horizontal scroll needed */
}

#slider-track {
  display: flex;
  flex-direction: column; /* STACK vertically */
  width: 100%;
  gap: 20px; /* Space between sets */
  transition: none;
}

/* Each quiz set "card" */
.set-group {
  width: 100%;
  max-width: 750px;
  margin: 0 auto;
  margin-top: 24px;
  margin-bottom: 24px;
  padding: 24px 16px 16px 16px;
  background: #fafbfcae;
  border-radius: 18px;
  box-shadow: 0 4px 24px #eee;
  box-sizing: border-box;
  transition: box-shadow 0.2s;
}
body.dark-mode .set-group {
  background: rgba(56, 56, 56, 0.667);
  color: #676768; 
  box-shadow: 0 6px 32px #222a; /* darker drop shadow */
  border-radius: 18px;
}
.set-group:hover {
  box-shadow: 0 8px 36px #e2e3e5;
}

/* Set titles */
.set-group h3 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 22px;
  color: #555;
  text-align: center;
  letter-spacing: 1px;
  width: 100%;
}

/* Each question/answer row */
.match-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: stretch;
  width: 100%;
  max-width: 700px;
  gap: 15px;
  margin: 0 auto 12px auto;
}

/* Question box style */
.question-box {
  width: 100%;
  max-width: 250px;
  min-width: 150px;
  min-height: 40px;
  box-sizing: border-box;
  padding: 15px;
  border: 2px solid #ccc;
  border-radius: 10px;
  background: linear-gradient(145deg, #ffffff 0%, #f9f9f9 100%);
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  box-shadow: 0 0 5px #ccc, 0 0 10px #ddd, inset 0 0 5px #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  word-wrap: break-word;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Arrow style */
.arrow {
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  line-height: 3;
}

/* Where the answer gets dropped */
.answer-slot {
  width: 100%;
  max-width: 250px;
  min-width: 150px;
  min-height: 40px;
  box-sizing: border-box;
  padding: 10px;
  border: 2px solid #999;
  border-radius: 8px;
  background-color: #f1f1f1;
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.3s, border 0.3s;
  box-shadow: 0 0 5px #ccc;
}

/* When answer is being dragged over */
.answer-slot.drag-over {
  background-color: #e0e0ff;
  border-color: #6c63ff;
}

/* When correct/wrong */
.answer-slot.correct {
  background-color: #c5ffca !important;
  border-color: #35ad4a !important;
}
.answer-slot.wrong {
  background-color: #ffd8d8 !important;
  border-color: #f95b5b !important;
}

/* Draggable answers */
.match-draggable {
  width: auto;
  min-width: 50px;
  max-width: 100%;
  height: 40px;
  background: linear-gradient(145deg, #ffffff 0%, #f2f2f2 100%);
  color: #333333;
  padding: 15px;
  border-radius: 10px;
  border: 2px solid #ccc;
  cursor: grab;
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  user-select: none;
  margin: 5px;
  box-shadow: 0 0 5px #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.match-draggable:hover {
  background: linear-gradient(145deg, #eeeeee, #ffffff);
  transform: scale(1.05);
  box-shadow: 0 0 15px #ccc;
}
.match-draggable:active {
  cursor: grabbing;
}

/* The row of answer choices */
.answers-row {
  width: 100%;
  max-width: 700px;
  margin: 20px auto 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 0 10px;
}


/* ================================
   BUTTONS & INTERACTIVES
================================== */
.mode-button,
#submit-matching {
  background: linear-gradient(145deg, #e0e0e0, #ffffff);
  color: #333333;
  font-size: 20px;
  padding: 10px 20px;
  border-radius: 10px;
  border: 2px solid #ccc;
  margin: 10px;
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
}
.mode-button:hover,
#submit-matching:hover {
  transform: scale(1.05);
  box-shadow: 0 0 10px #bbb;
}
.mode-button.active-mode {
  box-shadow: 0 0 15px #6c63ff;
  transform: scale(1.1);
}
body.dark-mode .mode-button.active-mode {
  box-shadow: 0 0 15px #aaaaff;
  transform: scale(1.1);
}
#result button,
#return-button, 
#retry-button,
#next-button {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px;
  padding: 12px 20px;
  font-size: 32px;
  border-radius: 20px;
  cursor: pointer;
  border: none;
  background-color: #6b63ff1f;
  color: white;
  transition: background-color 0.3s;
}
#result button:hover,
#return-button:hover,
#retry-button:hover,
#next-button:hover {
  background-color: #5954e814;
  transform: scale(1.05);
}
#return-button img,
#retry-button img,
#next-button img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
}
body.dark-mode #return-button img,
body.dark-mode #retry-button img,
body.dark-mode #next-button img {
  filter: invert(1);
}
.icon-btn {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: invert(0);
  transition: transform 0.2s;
}
button:hover .icon-btn {
  transform: scale(1.2);
}
.result-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 30px;
  flex-wrap: wrap;
}

/* ================================
   TYPING QUIZ LAYOUT
================================== */
.typing-row-horizontal {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 30px;
  margin-bottom: 20px;
  width: 100%;
  max-width: 800px;
  flex-wrap: nowrap;
}
.typing-row-horizontal:first-child {
  margin-top: 70px;
}

.typing-quiz-box {
  background: linear-gradient(145deg, #ffffff97, #f9f9f992);
  border-radius: 20px;
  padding: 30px 20px;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 900px;
  margin: 40px auto;
  box-sizing: border-box;
}

/* Dark mode support */
body.dark-mode .typing-quiz-box {
  background: linear-gradient(145deg, #111111b1, #1a1a1aaf);
  border: 1px solid #444;
  box-shadow: 0 6px 30px rgba(255, 255, 255, 0.07);
}

.typing-question-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}
.question-number {
  font-size: 24px;
  font-weight: bold;
  color: #333;
  min-width: 30px;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
body.dark-mode .question-number {
  color: #fff;
}


.typing-question-box {
  width: 300px;
  height: flex;
  min-height: 70px;
  background: linear-gradient(145deg, #ffffff, #f9f9f9);
  color: #333;
  font-weight: bold;
  font-size: 24px;
  padding: 5px 20px;
  border-radius: 10px;
  border: 2px solid #ddd;
  box-shadow: 0 0 5px #ccc, 0 0 10px #eee, inset 0 0 5px #f9f9f9;
  display: flex;
  align-items: center;
  justify-content: left;
  box-sizing: border-box;
  opacity: 0;
}
.typing-input {
  width: 300px;
  height: 70px;
  font-size: 24px;
  padding: 15px 20px;
  border-radius: 10px;
  border: 2px solid #ccc;
  background: linear-gradient(145deg, #ffffff, #f2f2f2);
  color: #333;
  box-sizing: border-box;
  opacity: 0;
}
/* Dark mode adjustments */
body.dark-mode .typing-question-box {
  background: linear-gradient(145deg, #0a0a0a, #1a1a1a);
  color: white;
  border: 2px solid #555;
  box-shadow: 0 0 10px #ffffff33, inset 0 0 5px #000000;
}
body.dark-mode .typing-input {
  background: linear-gradient(145deg, #1a1a1a, #2a2a2a);
  color: white;
  border: 2px solid #555;
}
.typing-input.correct {
  border-color: #28a745;
  background-color: #d4edda;
  color: #155724;
}
.typing-input.wrong {
  border-color: #dc3545;
  background-color: #f8d7da;
  color: #721c24;
}
.correct-answer-hint {
  font-size: 16px;
  color: #28a745;
  font-weight: initial;
  margin-top: 10px;
  margin-right: 10px;
  text-align: left;
}
body.dark-mode .correct-answer-hint {
  color: #67eaa6;
}

/* ================================
   TYPING SUBMIT BUTTON
================================== */
.typing-submit-btn {
  margin-top: 20px;
  margin-bottom: 10px;
  margin-left: 40px;
  font-size: 16px;
  font-weight: bold;
  padding: 10px 10px;
  background: linear-gradient(145deg, #6c63ff, #5a54cc);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: background 0.3s, transform 0.2s ease;
}
.typing-submit-btn:hover {
  background: linear-gradient(145deg, #5a54cc, #4a44bb);
  transform: scale(1.05);
}
.typing-submit-btn:disabled {
  background: #cccccc;
  color: #888;
  cursor: not-allowed;
  box-shadow: none;
}
.typing-submit-container {
  display: flex;
  justify-content: center;
  position: relative;
  bottom: 20px;
  left: 0;
  right: 0;
}

body.dark-mode .typing-submit-btn {
  background: linear-gradient(145deg, #8880ff, #5a54cc);
  color: #fff;
}
body.dark-mode .typing-submit-btn:disabled {
  background: #444;
  color: #aaa;
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

/* ================================
   THEME TOGGLE SWITCH
================================== */
.toggle-switch {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 20px;
  background-color: #ccc;
  border-radius: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 5px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  transition: background-color 0.4s;
}
.toggle-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: white;
  transition: transform 0.4s, background-color 0.4s;
}
body.dark-mode .toggle-switch {
  background-color: #555;
}
body.dark-mode .toggle-thumb {
  transform: translateX(30px);
  background-color: #222;
}

/* ================================
   DARK MODE - GLOBAL
================================== */
body.dark-mode {
  background: linear-gradient(-45deg, #0a0a0a, #1a1a1a, #2a2a2a, #0a0a0a);
  background-size: 400% 400%;
  animation: gradientMove 10s ease infinite;
  color: white;
}
@keyframes gradientMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
body.dark-mode h1, body.dark-mode h2 {
  color: #ffffff;
  text-shadow: 0 0 8px #ffffff;
}
body.dark-mode .level-button,
body.dark-mode .mode-button,
body.dark-mode .subject-button,
body.dark-mode #prev-btn,
body.dark-mode #next-btn {
  background: linear-gradient(145deg, #222222, #111111);
  color: #ffffff;
  border: 2px solid #555;
  box-shadow: 0 0 5px #ffffff66, 0 0 10px #ffffff33;
}
body.dark-mode .level-button:hover,
body.dark-mode .mode-button:hover,
body.dark-mode .subject-button:hover,
body.dark-mode #prev-btn:hover,
body.dark-mode #next-btn:hover {
  background: linear-gradient(145deg, #333333, #222222);
  box-shadow: 0 0 10px #ffffffaa;
}
body.dark-mode .question-box,
body.dark-mode .answer-slot,
body.dark-mode .match-draggable,
body.dark-mode #question-text,
body.dark-mode .option-button {
  background: linear-gradient(145deg, #0a0a0a 0%, #1a1a1a 100%);
  color: #ffffff;
  box-shadow: 0 0 5px #ffffff, 0 0 5px #ffffff, inset 0 0 5px #000000;
}
body.dark-mode .answer-slot.drag-over {
  background-color: #333366;
  border-color: #aaaaff;
}
body.dark-mode .option-button:hover,
body.dark-mode .match-draggable:hover {
  background: linear-gradient(145deg, #3a3a3a, #2a2a2a);
  box-shadow: 0 0 15px #ffffff99;
}
body.dark-mode #timer-container {
  background-color: #333333;
}
body.dark-mode #timer-bar {
  background-color: #f7f9f7;
  box-shadow: 0 0 20px #f7f9f7, 0 0 40px #f7f9f7, 0 0 60px #f7f9f7;
}
body.dark-mode .correct {
  background-color: #ffffff !important;
  color: #28a745 !important;
  border-color: #28a745 !important;
}
body.dark-mode .wrong {
  background-color: #ffffff!important;
  color: #dc3545 !important;
  border-color: #dc3545 !important;
}

/* ================================
   RESPONSIVE (Mobile)
================================== */
@media (max-width: 600px) {
  /* Landing */
  .landing-content {
  position: relative;
  z-index: 10;
  padding: 24px 20px;
  border-radius: 14px;
  }
  .instructor-name {
    font-size: 28px;
  }
  .subtitle {
    font-size: 18px;
  }
  .contact-info p {
    font-size: 14px;
  }
  #start-button {
    font-size: 16px;
    padding: 10px 18px;
  }
  /* Levels/Subjects */
  #levels {
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));;
    gap: 14px;
    max-width: 300px;
    margin-bottom: 60px;
  }
  .level-button { 
    font-size: 16px;
    width: 60px;
    height: 60px;
    border-radius: 14px;
  }
  .subject-button {
    width: 90px;
    height: 90px;
    font-size: 12px;
    border-radius: 14px;
    padding: 5px;
  }
  
  /* Matching */
  .question-box,
  .answer-slot {
    width: 100%;
    box-sizing: border-box;
    margin: 0 5px; 
    font-size: 16px;
    padding: 12px;
    height: auto;
  }

  .match-draggable {
    width: auto;
    min-width: 50px;
    max-width: 100%;
    height: 30px;
    font-size: 14px;
    padding: 5px;
  }
  .answers-row {
    gap: 1px;
  }
  .arrow {
    display: none;
  }
  #prev-btn,
  #next-btn {
    display: none !important;
  }
    /* Typing quiz */
    .typing-row-horizontal {
      gap: 5px;
      margin-bottom: 10px;
    }
    .typing-question-wrapper {
      gap: 8px;
    }
    .question-number {
      font-size: 16px;
      min-width: 20px;   /* Enough for '10', '12' etc */
      width: 20px;       /* Fix width for all numbers */
      margin-left: 5px;
      display: flex;
      justify-content: left; /* Right-align inside box */
    }

    .typing-question-box {
      flex: 1;
      font-size: 16px;
      height: 70px;
      margin-right: 8px;
      max-width: 170px;
    }
    .typing-input {
      font-size: 16px;
      height: 70px;
      max-width: 170px;
      width: 100%;
    }
  }
.return-button-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 30px;
}

#feedback-section {
  margin-top: 30px;
  text-align: center;
  padding: 20px;
  background-color: #fefefe;
  border-radius: 12px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.dark-mode #feedback-section {
  background-color: #222;
  color: #fff;
  box-shadow: 0 4px 12px rgba(255,255,255,0.07);
  border: 1.5px solid #444;
}

#telegram-link {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 20px;
  background-color: #0088cc;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: bold;
  transition: background 0.3s;
}

#telegram-link:hover {  
  background-color: #006fbf;
}
@keyframes fadeInUp {
  0% { opacity: 0; transform: translateY(20px);}
  100% { opacity: 1; transform: translateY(0);}
}
.option-button {
  animation: fadeInUp 0.6s;
}
.option-button:active,
#submit-matching:active {
  transform: scale(0.96);
  transition: transform 0.1s;
}

@keyframes correctPulse {
  0% { box-shadow: 0 0 0 0 #28a74555; }
  70% { box-shadow: 0 0 0 10px #28a74500; }
  100% { box-shadow: 0 0 0 0 #28a74500; }
}
@keyframes wrongPulse {
  0% { box-shadow: 0 0 0 0 #dc354555; }
  70% { box-shadow: 0 0 0 10px #dc354500; }
  100% { box-shadow: 0 0 0 0 #dc354500; }
}

.typing-input.correct,
.option-button.correct {
  animation: correctPulse 0.6s;
}

.typing-input.wrong,
.option-button.wrong {
  animation: wrongPulse 0.6s;
}

@keyframes diamondPop {
  0% { transform: scale(1);}
  40% { transform: scale(1.2);}
  100% { transform: scale(1);}
}
#diamond-bar.pop {
  animation: diamondPop 0.6s;
}


@keyframes gentle-wobble {
  0%   { transform: rotate(0deg); }
  25%  { transform: rotate(1deg); }
  50%  { transform: rotate(0deg); }
  75%  { transform: rotate(-1deg); }
  100% { transform: rotate(0deg); }
}

@keyframes slideInLeft {
  0% {
    opacity: 0;
    transform: translateX(-50px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  0% {
    opacity: 0;
    transform: translateX(50px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.match-row {
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards;
}
.flashcard-speaker {
  position: absolute;
  top: 5px;
  left: 6px;
  font-size: 15px;
  color: #6c63ff;
  cursor: pointer;
  z-index: 3;
  user-select: none;
  transition: transform 0.2s;
}
.flashcard-speaker:hover {
  transform: scale(1.2);
}
.deck-text-box {
  margin: 20px auto;
  padding: 20px;
  max-width: 800px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  font-size: 17px;
  line-height: 1.7;
  color: #333;
  transition: background 0.3s ease, color 0.3s ease;
}

/* 🌙 Dark mode */
body.dark-mode .deck-text-box {
  background: #1e1e1e ;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.05);
}

.deck-text-box strong {
  font-weight: bold;
  color: #6C63FF;
}


.deck-text-box pre {
  font-family: 'Segoe UI', sans-serif;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
  background: transparent;
  font-size: 17px;
  line-height: 1.7;
}

body.dark-mode .deck-text-box pre {
  color: #e0e0e0;
}

.spoiler {
  color: transparent;
  background-color: #ccc;
  cursor: pointer;
  user-select: none;
}

.spoiler.revealed {
  color: inherit;
  background-color: transparent;
}
