/* Background pastel gradient */
body {
  background: linear-gradient(180deg, #ffeef7 0%, #fff7ff 50%, #f6efff 100%);
  font-family: 'Poppins', sans-serif;
  overflow-x: hidden;
}

/* Pastel card */
.pastel-card {
  background: #ffffffcc;
  border: 2px solid #f7d9ff;
  border-radius: 20px;
  backdrop-filter: blur(6px);
}

/* Title */
.title {
  font-size: 28px;
  font-weight: 700;
  color: #6a4580;
}

/* Name screen */
#name-screen {
  position: fixed;
  inset: 0;
  background: #ffeefa;
  z-index: 999;
  display: flex;
}

#name-screen.hidden {
  display: none !important;
}

#name-box {
  max-width: 380px;
  width: 90%;
  border: 3px solid #ffd6ec;
  border-radius: 25px;
}

.container {
  padding-top: 2rem;
}

#quiz-container,
#result {
  max-width: 600px;
  margin: 0 auto 40px auto;
  padding: 20px !important;
}


/* Pastel button */
.pastel-btn {
  background: #ffb8dd;
  color: #4f1232;
  border-radius: 16px;
  font-weight: 600;
}

@media (hover: hover) and (pointer: fine) {
  .pastel-btn:hover {
    background: #ff9aca;
    transform: scale(1.03);
  }
}

.pastel-btn:active {
  background: #ff9aca;
  transform: scale(0.98);
}

/* Arabic text */
.arabic {
  font-size: 25px;
  font-weight: 700;
  color: #5a2180;
}

/* Choices / Options */
.choice-item {
  cursor: pointer;
  transition: all 0.3s ease;
  background: #fff;
  border: 2px solid #ffd6ec !important;
}

@media (hover: hover) and (pointer: fine) {
  .choice-item:hover {
    background: #fff0f8;
    transform: translateX(8px);
    border-color: #ffb8dd !important;
  }
}

.choice-item:active {
  background: #fff0f8;
  border-color: #ffb8dd !important;
}

.pastel-option {
  font-weight: 500;
  color: #4a2560;
}

/* Correct/Wrong answers */
.correct {
  background: #d4ffdc !important;
  border-color: #7cdb8d !important;
  color: #1a5c2a;
}

.wrong {
  background: #ffd4d4 !important;
  border-color: #ff8a8a !important;
  color: #7a1f1f;
}

/* Multi-select checkboxes */
.form-check {
  padding: 12px;
  border-radius: 10px;
  background: #fff;
  border: 2px solid #ffd6ec;
  transition: all 0.3s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-direction: row-reverse;
  justify-content: space-between;
  width: 100%;
}

@media (hover: hover) and (pointer: fine) {
  .form-check:hover {
    background: #fff0f8;
  }
}

.form-check:active {
  background: #fff0f8;
}

.form-check-input {
  width: 24px;
  height: 24px;
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
}

.form-check-label {
  cursor: pointer;
  margin: 0;
  flex: 1;
  user-select: none;
  display: block;
}

/* Grouping / Drag & Drop */
.grouping-instruction {
  margin-bottom: 12px;
  font-weight: 600;
  color: #6a4580;
  font-size: 15px;
}

.letters-container {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 15px;
  background: #fff0f8;
  border-radius: 12px;
  border: 2px dashed #ffd6ec;
  min-height: 60px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.letters-container.drag-over {
  background: #ffe6f5;
  border-color: #ffb8dd;
}

.letter-item {
  background: #ffe6f5;
  padding: 8px 14px;
  border-radius: 10px;
  border: 2px solid #ffb8dd;
  cursor: grab;
  transition: all 0.3s ease;
  user-select: none;
  touch-action: none;
}

.letter-item.tap-selected {
  background: #d4b3ff !important;
  border-color: #9b6bff !important;
  box-shadow: 0 0 12px rgba(155, 107, 255, 0.5);
  transform: scale(1.05);
}

.letter-item:active {
  cursor: grabbing;
}

.letter-item .arabic {
  font-size: 32px;
  color: #7a2ea5;
}

.categories-container {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.category-box {
  flex: 1;
  min-width: 200px;
  background: #fff;
  border: 2px solid #ffd6ec;
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.category-box.drag-over {
  background: #f0f8ff;
  border-color: #b8d4ff;
}

.category-box h5 {
  color: #7a2ea5;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  pointer-events: none;
}

.drop-zone {
  min-height: 100px;
  border: 2px dashed #d8a8ff;
  border-radius: 10px;
  padding: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  background: #fafafe;
}

.letter-item.correct {
  background: #d4ffdc !important;
  border-color: #7cdb8d !important;
}

.letter-item.wrong {
  background: #ffd4d4 !important;
  border-color: #ff8a8a !important;
}

.form-check.correct {
  background: #d4ffdc !important;
  border-color: #7cdb8d !important;
}

.form-check.wrong {
  background: #ffd4d4 !important;
  border-color: #ff8a8a !important;
}

.box {
  width: 30%;
  min-height: 180px;
  background: #ffffffcc;
  border: 2px dashed #d8a8ff;
  border-radius: 16px;
  padding: 10px;
  text-align: center;
  transition: 0.3s;
}

.box.correct { border-color: #7ed957; }
.box.wrong { border-color: #ff6363; }

.box h3 {
  margin-bottom: 10px;
  color: #7a2ea5;
  font-size: 18px;
}

.letters {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.letter {
  background: #f8e6ff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 26px;
  cursor: grab;
  border: 2px solid #d8a8ff;
  transition: 0.2s;
}



/* Bubbles */
.bubbles span {
  position: fixed;
  bottom: -120px;
  width: 40px;
  height: 40px;
  background: #ffd9ec;
  border-radius: 50%;
  opacity: 0.5;
  animation: floatUp 14s infinite ease-in;
}

.bubbles span:nth-child(2) { left: 20%; width: 20px; height: 20px; animation-duration: 16s; background:#e7d4ff; }
.bubbles span:nth-child(3) { left: 40%; width: 55px; height: 55px; animation-duration: 18s; background:#ffd6f6; }
.bubbles span:nth-child(4) { left: 60%; width: 25px; height: 25px; animation-duration: 20s; background:#ffe1ef; }
.bubbles span:nth-child(5) { left: 80%; width: 40px; height: 40px; animation-duration: 22s; background:#fde2ff; }

@keyframes floatUp {
  from { transform: translateY(0) scale(1); opacity: 0.6; }
  to { transform: translateY(-100vh) scale(1.4); opacity: 0; }
}

/* ========== RESPONSIVE MOBILE ========== */
@media (max-width: 768px) {
  /* Title */
  .title {
    font-size: 20px;
    margin-bottom: 1rem !important;
    padding-top: 1rem !important;
  }

  /* Container padding */
  .container {
    padding: 0 15px;
    margin-top: 0.5rem !important;
    padding-top: 1.5rem !important;
  }

  /* Name box */
  #name-box {
    padding: 1.5rem !important;
    max-width: 90%;
  }

  #name-box h2 {
    font-size: 22px;
  }

  /* Cards */
  .pastel-card {
    padding: 1rem !important;
    border-radius: 15px;
  }

  /* Question text */
  #quiz-container h4 {
    font-size: 16px;
    line-height: 1.5;
  }

  /* Arabic text smaller on mobile */
  .arabic {
    font-size: 28px;
  }

  /* Choice items */
  .choice-item {
    padding: 0.75rem !important;
    font-size: 14px;
    margin-bottom: 0.5rem !important;
  }

  /* Checkbox options */
  .form-check {
    padding: 0.75rem;
    font-size: 14px;
    margin-bottom: 0.5rem !important;
  }

  .form-check-input {
    width: 28px;
    height: 28px;
  }

  .form-check-label {
    font-size: 14px;
  }

  /* Grouping - mobile */
  .letters-container {
    padding: 10px;
    gap: 8px;
  }

  .letter-item {
    padding: 6px 12px;
    font-size: 14px;
  }

  .letter-item .arabic {
    font-size: 28px;
  }

  .categories-container {
    flex-direction: column;
    gap: 10px;
  }

  .category-box {
    min-width: 100%;
  }

  .category-box h5 {
    font-size: 15px;
  }

  .drop-zone {
    min-height: 80px;
  }

  /* Buttons */
  .pastel-btn {
    padding: 0.6rem 1rem;
    font-size: 14px;
  }

  /* Result screen */
  #result h3 {
    font-size: 22px;
  }

  #result .fs-5 {
    font-size: 16px !important;
  }

  #result .fs-2 {
    font-size: 32px !important;
  }

  /* Bubbles smaller and less on mobile */
  .bubbles span:nth-child(3),
  .bubbles span:nth-child(5) {
    display: none;
  }
}

@media (max-width: 480px) {
  /* Extra small phones */
  .title {
    font-size: 18px;
  }

  #name-box h2 {
    font-size: 20px;
  }

  .arabic {
    font-size: 24px;
  }

  #quiz-container h4 {
    font-size: 15px;
  }

  .choice-item,
  .form-check {
    font-size: 13px;
    padding: 0.6rem !important;
  }
}
