.expex-exercise {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;
  margin: 20px 4px;
  padding: 20px;
  background: #f9f9f9;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  color: #333;
  max-width: 52ch;
}

/* Introductory text */
/* .expex-exercise > p:first-of-type {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  color: #555;
} */

/* Styling the input fields */
.expex-exercise input {
  font-size: 16px;
  padding: 8px 6px;
  margin: 0 5px;
  border: none;
  border-bottom: 2px solid gray;
  /* border-radius: 8px; */
  /* background: #ffffff; */
  color: #333;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.expex-exercise input:not([type="radio"]) {
  height: 2rem; /* Increased from 1.6rem */
  /* Width will be set inline based on answer length */
  min-width: 3ch;
}

.expex-exercise input:focus {
  border-color: #007aff;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.3);
  outline: none;
}

/* Paragraph style */
.expex-exercise p {
  font-size: 16px;
  line-height: 1.6;
  color: #333;
  margin-bottom: 0.25rem;
}

/* Button styling */
.expex-exercise button:not(.play-button) {
  font-size: 16px;
  font-weight: 600;
  padding: 10px 20px;
  margin-top: 20px;
  color: #fff;
  background-color: #007aff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.expex-exercise button:not(.play-button):hover {
  background: #005ecb;
}

.expex-exercise button:not(.play-button):active {
  transform: scale(0.98);
}
.expex-exercise .question {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.expex-exercise .question:hover {
  border-color: #007aff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

/* Image styling */
.expex-exercise .question img {
  border-radius: 8px; /* Rounded corners for images */
  object-fit: cover; /* Maintain aspect ratio */
  width: 132px; /* Keep existing width */
  height: auto;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Subtle shadow */
}

/* Question text container */
.expex-exercise .question p {
  flex: 1; /* Take remaining space */
  margin: 0; /* Remove default margins */
  display: flex;
  align-items: baseline; /* Center text vertically with input */
  flex-direction: column;
}

/* Radio button containers */
.expex-exercise .question label {
  display: block; /* Stack radio options vertically */
  margin: 0.5rem 0; /* Space between options */
  padding: 0.3rem 0; /* Clickable padding */
}

/* Result text styling */
.th-exercise-result {
  font-size: 14px;
  color: #007aff;
  font-weight: 500;
}

/* Make layout more dynamic on smaller devices */
@media (max-width: 480px) {
  .expex-exercise {
    padding: 15px;
  }

  .expex-exercise input {
    width: fit-content;
  }
}

/* Success color: a muted green that works well with our design */
.expex-exercise input.correct,
.expex-exercise select.correct {
  border: 2px solid #34c759; /* Apple's system green */
  color: #34c759;
  background-color: rgba(52, 199, 89, 0.1); /* Subtle green background */
}

/* Error color: a softer red that matches Apple's design language */
.expex-exercise input.incorrect,
.expex-exercise select.incorrect {
  border: 2px solid #ff3b30; /* Apple's system red */
  color: #ff3b30;
}

.expex-exercise label.correct {
  color: #34c759;
}

.expex-exercise label.incorrect {
  color: #ff3b30;
}

/* Style for select elements to match inputs */
.expex-exercise select {
  font-size: 16px;
  padding: 8px 12px;
  margin: 0 5px;
  height: 2.4rem; /* Slightly taller than inputs to account for dropdown arrow */
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: #ffffff;
  color: #333;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none; /* Remove default styling */
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007AFF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 8px auto;
  padding-right: 30px; /* Make room for dropdown arrow */
}

.expex-exercise select:focus {
  border-color: #007aff;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.3);
  outline: none;
}

/* Incomplete exercise highlighting */
.expex-exercise.incomplete {
  animation: none; /* Remove pulsing animation from container */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); /* Reset to normal shadow */
}

.expex-exercise.incomplete .question:not(.answered) {
  border-color: #ff3b30;
  background-color: rgba(255, 59, 48, 0.05);
  animation: pulse 2s infinite; /* Move pulsing to individual questions */
  box-shadow: 0 2px 8px rgba(255, 59, 48, 0.15);
}

.expex-exercise.incomplete .question:not(.answered)::before {
  content: "!";
  position: absolute;
  right: 1rem;
  top: 1rem;
  width: 20px;
  height: 20px;
  background: #ff3b30;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
}

@keyframes pulse {
  0% {
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.15);
  }
  50% {
    box-shadow: 0 2px 12px rgba(255, 59, 48, 0.3);
  }
  100% {
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.15);
  }
}

/* Question answered state */
.expex-exercise .question.answered {
  border-color: #e0e0e0;
  background-color: white;
}
