/* css/exercise-types/reading-type3.css */
/* Word formation - Part 3 */

.reading-type3-container {
  background: linear-gradient(135deg, #faf5ff 0%, #ffffff 100%);
  border-radius: 20px;
  padding: 24px;
  border: 1px solid #e9d5ff;
}

.reading-type3-text {
  font-size: 1.15rem;
  line-height: 2;
  color: var(--text-dark);
  background: white;
  padding: 28px;
  border-radius: 16px;
}

/* Hover tooltip for incorrect answers */
.reading-type3-gap-inline {
  display: inline;
  white-space: nowrap;
  position: relative;
}

/* Word-formation inline gap: course-style pill (number + input / result) */
.reading-type3-wf-pill:focus-within {
  border-color: #9333ea;
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.14);
}

.reading-type3-wf-pill .cu-hint-pill-input:focus {
  border-color: #9333ea !important;
}

.reading-type3-wf-pill.reading-type3-gap-pill--example {
  pointer-events: none;
}

/* Inline results: same typography and padding as .cu-hint-pill-input (input rules unchanged). */
.reading-type3-wf-pill .reading-type3-answered-word,
.reading-type3-wf-pill .reading-type3-answered.reading-type3-example-answer,
.reading-type3-wf-pill .reading-type3-example-answer {
  margin-left: 0;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.45;
  padding: 3px 8px;
  min-width: 65px;
  border-radius: 10px;
  box-sizing: border-box;
}

.reading-type3-wf-pill .cu-hint-pill-word.cu-wf-pill-word {
  font-size: 0.9rem;
}

.reading-type3-gap-inline.incorrect {
  cursor: help;
}

.reading-type3-gap-inline.incorrect::after {
  content: attr(data-correct);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-dark);
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  white-space: nowrap;
  margin-bottom: 8px;
  display: none;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  font-weight: 600;
}

.reading-type3-gap-inline.incorrect:hover::after {
  display: block;
}

/* Modal: stem row + compact confirm (outside the bordered input row) */
.reading-type3-modal-field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 28px 0 12px;
  flex-wrap: nowrap;
}

/* Combined input + word badge layout in modal */
.reading-type3-input-word-row {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0;
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 16px;
  padding: 6px 6px 6px 12px;
  transition: border-color 0.2s;
}

.reading-type3-input-word-row:focus-within {
  border-color: #1E9D8E;
  box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.1);
}

.reading-type3-modal-input {
  flex: 1;
  padding: 10px 4px;
  border: none;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-weight: 500;
  font-size: 1.1rem;
  text-align: left;
  background: transparent;
  transition: all 0.2s;
  min-width: 0;
}

.reading-type3-modal-input:focus {
  outline: none;
}

.reading-type3-word-badge {
  background: #7e22ce;
  color: white;
  padding: 6px 16px;
  border-radius: 30px;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 1px;
  white-space: nowrap;
  flex-shrink: 0;
}

.reading-type3-gap-number {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
}

.reading-type3-gap-slot {
  display: inline-block;
  width: 70px;
  height: 24px;
  background: #f3e8ff;
  border: 1.5px solid #c084fc;
  border-radius: 6px;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 4px;
  transition: all 0.2s;
}

.reading-type3-gap-slot:hover {
  background: #e9d5ff;
  border-color: #1E9D8E;
  box-shadow: 0 2px 6px rgba(168, 85, 247, 0.15);
}

.reading-type3-answered-word {
  min-width: 65px;
  padding: 3px 8px;
  border: 1.5px solid #c084fc;
  border-radius: 10px;
  background: #f3e8ff;
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.45;
  margin-left: 4px;
  vertical-align: middle;
  text-align: center;
  box-sizing: border-box;
}

.reading-type3-purple {
  color: var(--primary);
  cursor: pointer;
}

.reading-type3-purple:hover {
  background: #ede9fe;
  border-color: #1E9D8E;
}

.reading-type3-correct {
  color: var(--correct);
  font-weight: 500;
  border-color: var(--correct);
  background: var(--ex-feedback-bg, #fff);
}

.reading-type3-show-correct {
  color: var(--ex-duo-purple-text, #5b21b6);
  font-weight: 600;
  border-color: var(--ex-duo-purple, #ce82ff);
  background: var(--ex-feedback-bg, #fff);
}

.reading-type3-incorrect {
  color: var(--incorrect);
  text-decoration: line-through;
  font-weight: 500;
  cursor: help;
  border-color: var(--incorrect);
  background: var(--ex-feedback-bg, #fff);
}

/* Modal styles for word formation */
.reading-type3-modal-word {
  text-align: center;
  margin: 16px 0;
}

.reading-type3-stem-label {
  font-weight: 800;
  color: #7e22ce;
  text-transform: uppercase;
  font-size: 1.4rem;
  background: #f3e8ff;
  padding: 8px 24px;
  border-radius: 12px;
  letter-spacing: 1px;
  border: 2px solid #c084fc;
}

.reading-type3-modal-input-wrap {
  display: none;
}

.reading-type3-modal-input-standalone {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-weight: 500;
  font-size: 1.2rem;
  text-align: center;
  transition: all 0.2s;
}

.reading-type3-modal-actions {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.reading-type3-word-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f3e8ff;
  padding: 4px 12px;
  border-radius: 30px;
  margin: 0 4px;
  border: 1px solid #c084fc;
  vertical-align: middle;
  transition: all 0.2s;
}

.reading-type3-word-box.reading-type3-filled {
  border-color: var(--primary-light);
  background: #f5f3ff;
}

.reading-type3-stem {
  font-weight: 700;
  color: #7e22ce;
  text-transform: uppercase;
  font-size: 0.9rem;
  background: white;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.reading-type3-input {
  width: 140px;
  padding: 8px 12px;
  border: 2px solid #cbd5e1;
  border-radius: 30px;
  font-family: 'Nunito', sans-serif;
  font-weight: 500;
  text-align: center;
  transition: all 0.2s;
  background: white;
}

.reading-type3-input:focus {
  outline: none;
  border-color: #1E9D8E;
  box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.1);
  width: 160px;
}

.reading-type3-input.correct {
  border-color: var(--correct);
  background-color: var(--ex-feedback-bg, #fff);
  color: #065f46;
}

.reading-type3-input.incorrect {
  border-color: var(--incorrect);
  background-color: var(--ex-feedback-bg, #fff);
  color: #991b1b;
}

.reading-type3-hint {
  display: inline-block;
  font-size: 0.9rem;
  color: #1E9D8E;
  background: #faf5ff;
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 4px;
  border: 1px dashed #c084fc;
}

@media (max-width: 480px) {
  .reading-type3-input,
  .reading-type3-input:focus {
    width: min(100%, 220px);
  }
}

.reading-type3-example-answer {
  color: var(--correct);
  font-weight: 500;
  pointer-events: none;
}

.reading-type3-correction {
  display: inline-block;
  color: #7e22ce;
  font-weight: 700;
  font-size: 0.95rem;
  margin-left: 4px;
  font-style: italic;
}

.reading-type3-confirm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-height: 38px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(145deg, #7e22ce, #6d28d9);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  align-self: center;
  box-shadow: 0 2px 8px rgba(126, 34, 206, 0.25);
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
}

.reading-type3-confirm-btn:hover {
  background: linear-gradient(145deg, #6d28d9, #5b21b6);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(126, 34, 206, 0.35);
}

.reading-type3-confirm-btn:active {
  transform: translateY(0);
}

.reading-type3-confirm-btn .material-symbols-outlined {
  font-size: 1.2rem;
}

.reading-type3-modal-q {
  width: 34px;
  height: 34px;
  min-height: 34px;
  font-size: 0.92rem;
}

@media (max-width: 480px) {
  .reading-type3-modal-field-row {
    margin: 32px 0 10px;
    gap: 8px;
    align-items: stretch;
  }

  .reading-type3-modal-field-row .reading-type3-confirm-btn {
    align-self: center;
    width: 36px;
    height: 36px;
    min-height: 36px;
    border-radius: 11px;
  }

  .reading-type3-input-word-row {
    gap: 6px;
    padding: 5px 5px 5px 9px;
  }

  .reading-type3-word-badge {
    max-width: 34%;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 6px 10px;
    font-size: 0.72rem;
  }

  .reading-type3-modal-q {
    width: 30px;
    height: 30px;
    min-height: 30px;
    font-size: 0.82rem;
  }
}

/* ── C1 Reading Part 3 — Duolingo-style word-formation pills (mirrors b1-reading6) ── */

.c1-reading3 .reading-type3-gap-inline {
  display: inline;
  white-space: nowrap;
  position: relative;
  margin: 0 2px;
  vertical-align: baseline;
}

.c1-reading3 .reading-type3-wf-pill {
  background: var(--ex-duo-blue-light, #ddf4ff);
  border: 2px solid var(--ex-duo-blue, #1cb0f6);
  border-radius: 14px;
  box-shadow: 0 2px 0 var(--ex-duo-blue-dark, #1899d6);
  padding: 2px 6px 2px 4px;
  gap: 4px;
  margin: 2px 1px;
  vertical-align: middle;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.c1-reading3 .reading-type3-wf-pill:focus-within {
  border-color: var(--ex-duo-blue, #1cb0f6);
  box-shadow: 0 2px 0 var(--ex-duo-blue-dark, #1899d6), 0 0 0 3px rgba(28, 176, 246, 0.18);
}

.c1-reading3 .reading-type3-wf-pill .cu-hint-pill-num {
  background: var(--ex-duo-blue, #1cb0f6);
  color: #fff;
  border: 2px solid var(--ex-duo-blue-dark, #1899d6);
  border-radius: 10px;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.75rem;
  padding: 1px 7px;
  min-width: 1.5em;
  text-align: center;
  line-height: 1.45;
}

.c1-reading3 .reading-type3-wf-pill:has(.reading-type3-correct) .cu-hint-pill-num,
.c1-reading3 .reading-type3-wf-pill:has(.cu-input-correct) .cu-hint-pill-num {
  background: var(--ex-duo-practice, #58cc02);
  border-color: var(--ex-duo-practice-dark, #58a700);
  color: #fff;
}

.c1-reading3 .reading-type3-wf-pill:has(.reading-type3-correct),
.c1-reading3 .reading-type3-wf-pill:has(.cu-input-correct) {
  background: #d7ffb8;
  border-color: var(--ex-duo-practice, #58cc02);
  box-shadow: 0 2px 0 var(--ex-duo-practice-dark, #58a700);
}

.c1-reading3 .reading-type3-wf-pill:has(.reading-type3-incorrect) .cu-hint-pill-num,
.c1-reading3 .reading-type3-wf-pill:has(.cu-input-incorrect) .cu-hint-pill-num {
  background: #ff4b4b;
  border-color: #ea2b2b;
  color: #fff;
}

.c1-reading3 .reading-type3-wf-pill:has(.reading-type3-incorrect),
.c1-reading3 .reading-type3-wf-pill:has(.cu-input-incorrect) {
  background: #ffdfe0;
  border-color: #ff4b4b;
  box-shadow: 0 2px 0 #ea2b2b;
}

.c1-reading3 .reading-type3-wf-pill:has(.reading-type3-show-correct) .cu-hint-pill-num,
.c1-reading3 .reading-type3-wf-pill:has(.cu-input-show-correct) .cu-hint-pill-num {
  background: var(--ex-duo-purple, #ce82ff);
  border-color: var(--ex-duo-purple-dark, #a855f7);
  color: #fff;
}

.c1-reading3 .reading-type3-wf-pill:has(.reading-type3-show-correct),
.c1-reading3 .reading-type3-wf-pill:has(.cu-input-show-correct) {
  background: var(--ex-duo-purple-light, #f3e8ff);
  border-color: var(--ex-duo-purple, #ce82ff);
  box-shadow: 0 2px 0 var(--ex-duo-purple-dark, #a855f7);
}

.c1-reading3 .reading-type3-pill-input {
  border: 2px solid var(--ex-duo-blue, #1cb0f6) !important;
  border-radius: 10px !important;
  background: #fff !important;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 0.9rem !important;
  min-width: 52px;
  width: 65px;
  color: var(--ex-duo-blue-dark, #1899d6) !important;
}

.c1-reading3 .reading-type3-pill-input:focus {
  border-color: var(--ex-duo-blue, #1cb0f6) !important;
  box-shadow: none !important;
}

.c1-reading3 .reading-type3-wf-pill .reading-type3-answered-word,
.c1-reading3 .reading-type3-wf-pill .reading-type3-answered.reading-type3-example-answer,
.c1-reading3 .reading-type3-wf-pill .reading-type3-example-answer {
  margin-left: 0;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.45;
  padding: 3px 8px;
  min-width: 52px;
  border-radius: 10px;
  box-sizing: border-box;
  text-align: center;
  background: #fff;
  border: 2px solid var(--ex-duo-blue, #1cb0f6);
}

.c1-reading3 .reading-type3-wf-pill .reading-type3-answered-word.reading-type3-correct,
.c1-reading3 .reading-type3-wf-pill .reading-type3-answered.reading-type3-example-answer {
  color: #065f46;
  background: #fff;
  border: 2px solid var(--ex-duo-practice, #58cc02);
}

.c1-reading3 .reading-type3-wf-pill .reading-type3-answered-word.reading-type3-incorrect {
  color: #991b1b;
  background: #fff;
  border: 2px solid #ff4b4b;
  text-decoration: line-through;
}

.c1-reading3 .reading-type3-wf-pill .reading-type3-answered-word.reading-type3-show-correct {
  color: #5b21b6;
  font-weight: 700;
  background: #fff;
  border: 2px solid var(--ex-duo-purple, #ce82ff);
}

/* Hint word: same badge style as the question number */
.c1-reading3 .reading-type3-wf-pill .cu-hint-pill-word.cu-wf-pill-word {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.75rem;
  font-weight: 800;
  color: #fff;
  background: var(--ex-duo-blue, #1cb0f6);
  border: 2px solid var(--ex-duo-blue-dark, #1899d6) !important;
  border-bottom-width: 2px !important;
  border-radius: 10px;
  padding: 1px 7px;
  line-height: 1.45;
  text-transform: uppercase;
  box-shadow: none !important;
}

.c1-reading3 .reading-type3-wf-pill:has(.reading-type3-correct) .cu-hint-pill-word.cu-wf-pill-word,
.c1-reading3 .reading-type3-wf-pill:has(.cu-input-correct) .cu-hint-pill-word.cu-wf-pill-word {
  background: var(--ex-duo-practice, #58cc02);
  border-color: var(--ex-duo-practice-dark, #58a700) !important;
  color: #fff;
  box-shadow: none !important;
}

.c1-reading3 .reading-type3-wf-pill:has(.reading-type3-incorrect) .cu-hint-pill-word.cu-wf-pill-word,
.c1-reading3 .reading-type3-wf-pill:has(.cu-input-incorrect) .cu-hint-pill-word.cu-wf-pill-word {
  background: #ff4b4b;
  border-color: #ea2b2b !important;
  color: #fff;
  box-shadow: none !important;
}

.c1-reading3 .reading-type3-wf-pill:has(.reading-type3-show-correct) .cu-hint-pill-word.cu-wf-pill-word,
.c1-reading3 .reading-type3-wf-pill:has(.cu-input-show-correct) .cu-hint-pill-word.cu-wf-pill-word {
  background: var(--ex-duo-purple, #ce82ff);
  border-color: var(--ex-duo-purple-dark, #a855f7) !important;
  color: #fff;
  box-shadow: none !important;
}

.c1-reading3 .reading-type3-gap-inline.incorrect::after {
  content: attr(data-correct);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  color: var(--ex-duo-text, #4b4b4b);
  border: 2px solid var(--ex-duo-purple, #ce82ff);
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  white-space: nowrap;
  display: none;
  z-index: 50;
  line-height: 1.3;
  box-shadow: 0 2px 0 var(--ex-duo-purple-dark, #a855f7);
  pointer-events: none;
}

.c1-reading3 .reading-type3-gap-inline.incorrect:hover::after {
  display: block;
}

.c1-reading3 .reading-type3-wf-pill.reading-type3-gap-pill--example,
.c1-reading3 .reading-type3-wf-pill:has(.reading-type3-example-answer) {
  background: var(--ex-feedback-bg, #fff);
  border-color: #58cc02;
  box-shadow: 0 2px 0 #58a700;
  pointer-events: none;
}

.c1-reading3 .reading-type3-wf-pill.reading-type3-gap-pill--example .cu-hint-pill-num,
.c1-reading3 .reading-type3-wf-pill:has(.reading-type3-example-answer) .cu-hint-pill-num {
  background: var(--ex-duo-practice, #58cc02);
  border-color: var(--ex-duo-practice-dark, #58a700);
  color: #fff;
}

.c1-reading3 .reading-type3-wf-pill.reading-type3-gap-pill--example .reading-type3-example-answer,
.c1-reading3 .reading-type3-wf-pill:has(.reading-type3-example-answer) .reading-type3-example-answer {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.95em;
  color: #3c3c3c;
  background: transparent;
  border: none;
  padding: 3px 8px 4px;
  min-width: 0;
}

.c1-reading3 .reading-type3-wf-pill.reading-type3-gap-pill--example .cu-hint-pill-word.cu-wf-pill-word,
.c1-reading3 .reading-type3-wf-pill:has(.reading-type3-example-answer) .cu-hint-pill-word.cu-wf-pill-word {
  background: var(--ex-duo-practice, #58cc02);
  border-color: var(--ex-duo-practice-dark, #58a700) !important;
  color: #fff;
  box-shadow: none !important;
}

.reading-text-enhanced--b1r-plain.c1-reading3 .toggle-text-section p {
  line-height: 2.75;
}

@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  .reading-text-enhanced--b1r-plain.c1-reading3 .toggle-text-section p {
    line-height: 2.4;
  }

  .c1-reading3 .reading-type3-pill-input {
    min-width: 44px;
    width: 56px;
    font-size: 0.85rem !important;
  }

  .c1-reading3 .reading-type3-wf-pill .cu-hint-pill-num,
  .c1-reading3 .reading-type3-wf-pill .cu-hint-pill-word.cu-wf-pill-word {
    font-size: 0.7rem;
    padding: 1px 5px;
  }
}
