/* ==========================================================================
   Exercises — Vocabulary Match, Fill in the Blank, Sentence Scramble
   Styled to blend with the reader's warm, literary aesthetic.
   ========================================================================== */

/* ---- Practice Section Container ---- */
.exercises-section {
  max-width: var(--max-width, 960px);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
  border-top: 1px solid var(--color-border-light);
}

.exercises-section__title {
  font-family: var(--font-heading);
  font-size: 22px;
  margin-bottom: var(--space-lg);
  color: var(--color-text);
}

/* ---- Collapsible Exercise Widget ---- */
.exercise {
  margin-bottom: var(--space-lg);
}

.exercise__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--color-border-light);
  margin-bottom: var(--space-md);
}

.exercise__header-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.exercise__name {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.exercise__count {
  font-size: 13px;
  color: var(--color-text-light);
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

.exercise__chevron {
  width: 18px;
  height: 18px;
  color: var(--color-text-light);
  transition: transform var(--transition-normal);
  flex-shrink: 0;
}

.exercise.open .exercise__chevron {
  transform: rotate(180deg);
}

.exercise__body {
  display: none;
}

.exercise.open .exercise__body {
  display: block;
}

/* ---- Completion State ---- */
.exercise__complete {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) 0;
  color: var(--color-a1);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
}

/* ==========================================================================
   1. Vocabulary Match — replaces the static Key Vocabulary section
   ========================================================================== */

.vocab-match {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm) var(--space-md);
}

.vocab-match__col {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.vocab-match__item {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 44px;
  display: flex;
  align-items: center;
  text-align: left;
  word-break: break-word;
  border-radius: var(--radius-sm);
}

.vocab-match__item:hover:not(.vocab-match__item--matched):not(.vocab-match__item--wrong) {
  background: rgba(0, 0, 0, 0.03);
}

.vocab-match__item--selected {
  background: var(--color-accent-light);
  border-color: transparent;
}

.vocab-match__item--matched {
  background: var(--color-a1-light);
  border-color: transparent;
  cursor: default;
  animation: matchPulse 0.4s var(--ease-out);
}

.vocab-match__item--wrong {
  background: var(--color-b2-light);
  animation: shake 0.4s var(--ease-out);
}

.vocab-match__item--es {
  font-family: var(--font-reading);
  font-weight: 600;
  font-size: 15px;
}

.vocab-match__item--en {
  font-family: var(--font-reading);
  font-size: 14px;
  color: var(--color-text-secondary);
}

.vocab-match__hint {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--color-text-light);
  font-style: italic;
  padding-bottom: var(--space-sm);
}

/* ==========================================================================
   2. Fill in the Blank
   ========================================================================== */

.fill-blank {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.fill-blank__question {
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
}

.fill-blank__question:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.fill-blank__counter {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.fill-blank__hint {
  font-family: var(--font-reading);
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
  font-style: italic;
  line-height: 1.5;
}

.fill-blank__sentence {
  font-family: var(--font-reading);
  font-size: 18px;
  line-height: 1.65;
  color: var(--color-text);
  margin-bottom: var(--space-md);
}

.fill-blank__gap {
  display: inline;
  border-bottom: 2px dashed var(--color-accent);
  padding: 0 2px;
  color: var(--color-accent);
  font-weight: 600;
}

.fill-blank__gap--correct {
  border-bottom-color: var(--color-a1);
  color: var(--color-a1);
  border-bottom-style: solid;
}

.fill-blank__options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.fill-blank__option {
  padding: 6px var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-family: var(--font-reading);
  font-size: 15px;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  background: var(--color-surface);
}

.fill-blank__option:hover:not(.fill-blank__option--correct):not(.fill-blank__option--wrong):not(.fill-blank__option--disabled) {
  border-color: var(--color-text-light);
  background: rgba(0, 0, 0, 0.02);
}

.fill-blank__option--correct {
  border-color: var(--color-a1);
  background: var(--color-a1-light);
  color: var(--color-a1);
  font-weight: 600;
  cursor: default;
  animation: matchPulse 0.4s var(--ease-out);
}

.fill-blank__option--wrong {
  border-color: var(--color-b2);
  background: var(--color-b2-light);
  animation: shake 0.4s var(--ease-out);
}

.fill-blank__option--disabled {
  opacity: 0.3;
  cursor: default;
}

/* ==========================================================================
   3. Sentence Scramble
   ========================================================================== */

.scramble {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.scramble__question {
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
}

.scramble__question:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.scramble__counter {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.scramble__hint {
  font-family: var(--font-reading);
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
  font-style: italic;
  line-height: 1.5;
}

/* Target area where user builds the sentence */
.scramble__target {
  min-height: 48px;
  padding: var(--space-sm);
  border-bottom: 2px dashed var(--color-border);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  align-items: center;
  margin-bottom: var(--space-md);
  transition: border-color var(--transition-fast);
}

.scramble__target:empty::before {
  content: 'Tap words to build the sentence...';
  color: var(--color-text-light);
  font-family: var(--font-reading);
  font-size: 14px;
  font-style: italic;
}

.scramble__target--correct {
  border-bottom-color: var(--color-a1);
  border-bottom-style: solid;
}

.scramble__target--wrong {
  border-bottom-color: var(--color-b2);
  animation: shake 0.4s var(--ease-out);
}

/* Word token chips */
.scramble__pool {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.scramble__token {
  padding: 6px var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-family: var(--font-reading);
  font-size: 15px;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  user-select: none;
  background: var(--color-surface);
}

.scramble__token:hover:not(.scramble__token--placed) {
  border-color: var(--color-text-light);
  background: rgba(0, 0, 0, 0.02);
}

.scramble__token--placed {
  opacity: 0.2;
  cursor: default;
  border-style: dashed;
}

/* Tokens in the target area */
.scramble__placed-token {
  padding: 6px var(--space-md);
  border: 1px solid var(--color-accent);
  background: var(--color-accent-light);
  border-radius: var(--radius-pill);
  font-family: var(--font-reading);
  font-size: 15px;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.scramble__placed-token:hover {
  background: #FDE68A;
}

.scramble__check-btn {
  align-self: flex-start;
  padding: 6px var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 44px;
  margin-top: var(--space-sm);
}

.scramble__check-btn:hover:not(:disabled) {
  border-color: var(--color-text-light);
  background: rgba(0, 0, 0, 0.02);
}

.scramble__check-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ==========================================================================
   Animations — subtle and non-disruptive
   ========================================================================== */

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

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

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 480px) {
  .vocab-match {
    gap: 6px var(--space-sm);
  }

  .vocab-match__item {
    padding: var(--space-sm) var(--space-sm);
    font-size: 13px;
  }

  .fill-blank__sentence {
    font-size: 16px;
  }

  .scramble__token,
  .scramble__placed-token {
    font-size: 14px;
    padding: 6px 10px;
    min-height: 40px;
  }
}
