/* css/exercise-types/reading-type2.css */
/* Open cloze - Part 2 */

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

.reading-type2-text {
  font-size: 1.15rem;
  line-height: 2;
  color: var(--text-dark);
  background: white;
  padding: 28px;
  border-radius: 16px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.reading-type2-gap {
  display: inline-block;
  margin: 0 4px;
  position: relative;
}

.reading-type2-gap.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);
}

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

.reading-type2-input {
  width: 120px;
  max-width: 100%;
  padding: 1px 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;
  font-size: 1.05rem;
  box-sizing: border-box;
}

.reading-type2-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(30, 58, 138, 0.1);
}

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

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

.reading-type2-input.incorrect:disabled {
  opacity: 0.8;
}

.reading-type2-input:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.reading-type2-input.cu-input-show-correct {
  border-color: #8b5cf6 !important;
  background: var(--ex-feedback-bg, #fff) !important;
  color: #5b21b6 !important;
  font-weight: 700;
}

.reading-type2-example {
  background: #f0f9ff;
  border-left: 6px solid #0ea5e9;
  padding: 16px 24px;
  margin: 20px 0;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.1);
}

.reading-type2-example strong {
  color: #0369a1;
  background: #e0f2fe;
  padding: 4px 12px;
  border-radius: 30px;
  font-size: 1rem;
  margin-right: 8px;
}

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

.reading-type2-gap-number {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.95rem;
  margin-right: 2px;
  vertical-align: middle;
}

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

/* ===== B1 Reading Part 6 — Duolingo-style open-cloze pills ===== */
.b1-reading6 .reading-type2-gap--duo,
.reading-text-enhanced--b1r-plain.b1-reading6 .reading-type2-gap--duo {
  display: inline;
  white-space: nowrap;
  position: relative;
  margin: 0 2px;
  vertical-align: baseline;
}

.b1-reading6 .reading-type2-oc-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;
}

.b1-reading6 .reading-type2-oc-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);
}

.b1-reading6 .reading-type2-oc-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;
}

.b1-reading6 .reading-type2-oc-pill:has(.reading-type2-correct) .cu-hint-pill-num,
.b1-reading6 .reading-type2-oc-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;
}

.b1-reading6 .reading-type2-oc-pill:has(.reading-type2-correct),
.b1-reading6 .reading-type2-oc-pill:has(.cu-input-correct) {
  background: #d1fae5;
  border-color: var(--correct, #10b981);
  box-shadow: 0 2px 0 var(--ex-duo-practice-dark, #58a700);
}

.b1-reading6 .reading-type2-oc-pill:has(.reading-type2-incorrect) .cu-hint-pill-num,
.b1-reading6 .reading-type2-oc-pill:has(.cu-input-incorrect) .cu-hint-pill-num {
  background: #ff4b4b;
  border-color: #ea2b2b;
  color: #fff;
}

.b1-reading6 .reading-type2-oc-pill:has(.reading-type2-incorrect),
.b1-reading6 .reading-type2-oc-pill:has(.cu-input-incorrect) {
  background: #fee2e2;
  border-color: var(--incorrect, #ef4444);
  box-shadow: 0 2px 0 #ea2b2b;
}

.b1-reading6 .reading-type2-oc-pill:has(.reading-type2-show-correct) .cu-hint-pill-num,
.b1-reading6 .reading-type2-oc-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;
}

.b1-reading6 .reading-type2-oc-pill:has(.reading-type2-show-correct),
.b1-reading6 .reading-type2-oc-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);
}

.b1-reading6 .reading-type2-pill-input {
  border: 2px solid var(--ex-duo-border, #e5e5e5) !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-text, #4b4b4b) !important;
}

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

.b1-reading6 .reading-type2-answered-word,
.b1-reading6 .reading-type2-answered.reading-type2-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;
}

.b1-reading6 .reading-type2-correct {
  color: #065f46;
  background: var(--ex-feedback-bg, #fff);
  border: 2px solid var(--correct, #10b981);
}

.b1-reading6 .reading-type2-incorrect {
  color: #991b1b;
  background: var(--ex-feedback-bg, #fff);
  border: 2px solid var(--incorrect, #ef4444);
  text-decoration: line-through;
  cursor: help;
}

.b1-reading6 .reading-type2-show-correct {
  color: #5b21b6;
  background: var(--ex-feedback-bg, #fff);
  border: 2px solid #8b5cf6;
  font-weight: 700;
}

.b1-reading6 .reading-type2-gap--duo.incorrect {
  cursor: help;
}

.b1-reading6 .reading-type2-gap--duo.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;
}

.b1-reading6 .reading-type2-gap--duo.incorrect:hover::after {
  display: block;
}

.b1-reading6 .reading-type2-oc-pill.reading-type2-oc-pill--example,
.b1-reading6 .reading-type2-oc-pill:has(.reading-type2-example-answer) {
  background: var(--ex-feedback-bg, #fff);
  border-color: #58cc02;
  box-shadow: 0 2px 0 #58a700;
  pointer-events: none;
}

.b1-reading6 .reading-type2-oc-pill--example .cu-hint-pill-num,
.b1-reading6 .reading-type2-oc-pill:has(.reading-type2-example-answer) .cu-hint-pill-num {
  background: var(--ex-duo-practice, #58cc02);
  border-color: var(--ex-duo-practice-dark, #58a700);
  color: #fff;
}

.b1-reading6 .reading-type2-oc-pill--example .reading-type2-example-answer,
.b1-reading6 .reading-type2-oc-pill:has(.reading-type2-example-answer) .reading-type2-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;
}

@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  .reading-type2-container {
    border-radius: 16px;
    padding: 16px;
  }

  .reading-type2-text {
    padding: 16px 18px;
    font-size: 1rem;
    line-height: 1.85;
  }

  .reading-type2-input {
    width: 100px;
    font-size: 0.95rem;
    padding: 6px 10px;
  }

  .reading-type2-example {
    padding: 12px 16px;
    margin: 14px 0;
  }

  .b1-reading6 .reading-type2-pill-input {
    min-width: 44px;
    width: 56px;
    font-size: 0.85rem !important;
  }

  .b1-reading6 .reading-type2-oc-pill .cu-hint-pill-num {
    font-size: 0.7rem;
    padding: 1px 5px;
  }
}

/* ── C1 Reading Part 2 — Duolingo-style open-cloze pills (SunE Play passage gap fill) ── */

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

.c1-reading2 .reading-type2-oc-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-reading2 .reading-type2-oc-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-reading2 .reading-type2-oc-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-reading2 .reading-type2-oc-pill:has(.reading-type2-correct) .cu-hint-pill-num,
.c1-reading2 .reading-type2-oc-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-reading2 .reading-type2-oc-pill:has(.reading-type2-correct),
.c1-reading2 .reading-type2-oc-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-reading2 .reading-type2-oc-pill:has(.reading-type2-incorrect) .cu-hint-pill-num,
.c1-reading2 .reading-type2-oc-pill:has(.cu-input-incorrect) .cu-hint-pill-num {
  background: #ff4b4b;
  border-color: #ea2b2b;
  color: #fff;
}

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

.c1-reading2 .reading-type2-oc-pill:has(.reading-type2-show-correct) .cu-hint-pill-num,
.c1-reading2 .reading-type2-oc-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-reading2 .reading-type2-oc-pill:has(.reading-type2-show-correct),
.c1-reading2 .reading-type2-oc-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-reading2 .reading-type2-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-reading2 .reading-type2-pill-input:focus {
  border-color: var(--ex-duo-blue, #1cb0f6) !important;
  box-shadow: none !important;
}

.c1-reading2 .reading-type2-answered-word,
.c1-reading2 .reading-type2-answered.reading-type2-example-answer,
.c1-reading2 .reading-type2-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-reading2 .reading-type2-answered-word.reading-type2-correct,
.c1-reading2 .reading-type2-answered.reading-type2-example-answer {
  color: #065f46;
  background: #fff;
  border: 2px solid var(--ex-duo-practice, #58cc02);
}

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

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

.c1-reading2 .reading-type2-gap--duo.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-reading2 .reading-type2-gap--duo.incorrect:hover::after {
  display: block;
}

.reading-text-enhanced--b1r-plain.c1-reading2 .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-reading2 .toggle-text-section p {
    line-height: 2.4;
  }

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

  .c1-reading2 .reading-type2-oc-pill .cu-hint-pill-num {
    font-size: 0.7rem;
    padding: 1px 5px;
  }
}
