#magnetn-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  background-color: #f9f9f9;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.sentence-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 15px;
  position: relative;
}

.exercise-number {
  font-size: 30px;
  font-weight: bold;
  color: #fff;                /* Texto blanco */
  background: #4a90e2;        /* Fondo azul */
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;         /* Círculo */
  position: absolute;
  top: 0px;
  right: 0px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  z-index: 2;
}

.sentence-image {
  text-align: center;
  margin-bottom: 20px;
}

.sentence-image img {
  max-height: 250px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sentence-text-prompt {
  background-color: #f0f8ff;
  border-inline-start: 4px solid #4a90e2;
  padding: 15px;
  border-radius: 6px;
  font-size: 20px;
  line-height: 1.6;
  color: #333;
  margin-bottom: 15px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.sentence-container:not(.has-image) .sentence-text-prompt {
  margin-inline-start: 40px;
}

.sentence-assembly-area {
  background-color: #fff;
  border-radius: 8px;
  padding: 15px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  position: relative;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
}

.sentence-prefix, .sentence-suffix {
  padding: 18px 10px;
  font-weight: bold;
  display: inline-flex;
  align-self: flex-start;
}

.sentence-suffix {
  align-self: flex-end;
  margin-left: -5px;
}

.sentence-drop-zone {
  flex: 1;
  min-height: 63px;
  border: 2px dashed #ccc;
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.sentence-drop-zone.highlight {
  background-color: #f0f8ff;
  border-color: #4a90e2;
}

.sentence-bits-container {
  background-color: #eef2f7;
  border-radius: 8px;
  padding: 15px;
  margin-top: 10px;
}

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

.sentence-bit {
  background-color: #4a90e2;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.sentence-bit:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.sentence-bit:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sentence-bit.dragging {
  opacity: 0.6;
}

.check-button-container {
  text-align: center;
  margin-top: 20px;
}

.word-counter {
  text-align: center;
  margin-bottom: 10px;
  font-size: 18px;
  font-weight: 600;
  direction: rtl;
}

.word-counter.incomplete {
  color: #ff9800;
}

.word-counter.complete {
  color: #4CAF50;
}

.word-counter .current-count {
  font-weight: bold;
  font-size: 20px;
}

.check-button {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 12px 30px;
  font-size: 18px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s ease;
}

.check-button:hover {
  background-color: #45a049;
}

.check-button:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

.final-message {
  text-align: center;
  padding: 30px;
}

.magnetn-summary {
  display: none;
  margin: 22px auto 0;
  max-width: 560px;
  padding: 16px 18px;
  border-radius: 8px;
  background-color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  text-align: start;
  direction: rtl;
}

.magnetn-summary-title {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 700;
}

.magnetn-summary-list {
  margin: 0;
  padding-inline-start: 24px;
}

.magnetn-summary-list li {
  margin-bottom: 8px;
  line-height: 1.5;
}

.magnetn-summary-list li:last-child {
  margin-bottom: 0;
}

.final-message img {
  max-width: 300px;
  margin: auto;
}

#replay-button {
  background-color: #4a90e2;
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 16px;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 20px;
}

#some-wrong-image {
  display: none;
}

/* Responsive adjustments */
@media (width > 768px) {
  .sentence-container.has-image .exercise-number {
    right: 25px;
  }
}

@media (max-width: 768px) {
  #magnetn-container {
    padding: 10px;
  }

  .sentence-container {
    padding: 10px;
    gap: 15px;
  }

  .sentence-image img {
    max-height: unset;
    max-width: 100%;
    height: auto;
    width: auto;
  }

  .sentence-assembly-area {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "prefix dropzone suffix";
    padding: 10px;
    gap: 5px;
    align-items: start;
  }

  .sentence-prefix {
    grid-area: prefix;
    align-self: start;
    padding: 18px 5px;
  }

  .sentence-suffix {
    grid-area: suffix;
    align-self: end;
    padding: 5px;
    margin-left: 0;
  }

  .sentence-drop-zone {
    grid-area: dropzone;
    margin: 0;
  }

  /* Para sufijos que son signos de puntuación */
  .sentence-suffix.punctuation-only {
    margin-left: -5px;
  }

  .sentence-bit {
    padding: 6px 10px;
    font-size: 14px;
    margin-bottom: 5px;
  }

  .check-button {
    padding: 10px 20px;
    font-size: 16px;
    width: 100%;
    max-width: 200px;
  }

  .word-counter {
    font-size: 16px;
    margin-bottom: 8px;
  }

  .word-counter .current-count {
    font-size: 18px;
  }

  .final-message img {
    max-width: 200px;
  }

  .magnetn-summary {
    margin-top: 18px;
    padding: 12px 14px;
  }

  .magnetn-summary-title {
    font-size: 18px;
  }

  .magnetn-summary-list {
    font-size: 15px;
  }
}

/* Para pantallas muy pequeñas */
@media (max-width: 480px) {
  .sentence-bits {
    gap: 5px;
  }

  .sentence-bit {
    padding: 5px 8px;
    font-size: 13px;
  }

  .sentence-image {
    margin-bottom: 10px;
  }

  .check-button-container {
    margin-top: 15px;
  }

  .word-counter {
    font-size: 15px;
  }

  .word-counter .current-count {
    font-size: 17px;
  }

  .sentence-assembly-area {
    padding: 8px;
    grid-gap: 3px;
  }

  .sentence-drop-zone {
    padding: 8px;
  }
}

/* SortableJS classes */
.sortable-ghost {
  opacity: 0.4;
}

.sortable-chosen {
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

.sortable-drag {
  opacity: 0.8;
  transform: rotate(3deg);
}

.sentence-drop-zone.incorrect {
  animation: shake 0.5s;
  border-color: #e74c3c;
  background-color: rgba(231, 76, 60, 0.1);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

/* Mejoras para táctil */
.sentence-bit {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  touch-action: none;
}

.sentence-drop-zone .sentence-bit {
  cursor: pointer;
}