/* Practice mode "In context" (fill in the blank) — js/screens/practice/cloze.js */

.cz-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.cz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 22px;
}

.cz-caption {
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--label-2);
}

/* Sentence with the blank */
.cz-sentence {
  margin: 12px 0 0;
  font-size: 22px;
  line-height: 31px;
  letter-spacing: -0.015em;
  color: var(--label);
  overflow-wrap: break-word;
}

.cz-blank {
  position: relative;
  display: inline-block;
  box-sizing: border-box;
  min-width: var(--cz-w, 5em);
  max-width: 100%;
  min-height: 1.4em;
  margin: 0 0.06em;
  padding: 0 0.3em;
  border-bottom: 2px dashed var(--accent);
  border-radius: 7px 7px 3px 3px;
  background: var(--accent-tint);
  color: var(--accent-on-tint);
  font: inherit;
  font-weight: 600;
  line-height: calc(1.4em - 2px);
  letter-spacing: -0.01em;
  text-align: center;
  /* A long phrase wraps inside the pill instead of running off the card. */
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: baseline;
}

/* 44pt hit area around the (shorter) blank in word-bank mode */
button.cz-blank::after {
  content: '';
  position: absolute;
  inset: -7px -4px;
}

.cz-blank.filled {
  border-bottom-style: solid;
}

.cz-fill {
  display: inline-block;
  animation: cz-pop 220ms var(--ease-out);
}

.cz-blank.is-right {
  border-bottom: 2px solid var(--green);
  background: var(--green-tint);
  color: var(--label);
}

/* Wrong: the learner's choice struck through, then the answer. Each part is
   its own small pill so the pair can wrap on narrow screens. */
.cz-blank.is-wrong {
  display: inline;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  white-space: normal;
}

.cz-was,
.cz-blank.is-wrong .cz-ans {
  display: inline-block;
  box-sizing: border-box;
  max-width: 100%;
  min-height: 1.4em;
  padding: 0 0.3em;
  border-radius: 7px 7px 3px 3px;
  line-height: calc(1.4em - 2px);
  white-space: normal;
  overflow-wrap: anywhere;
}

.cz-was {
  border-bottom: 2px solid var(--red);
  background: var(--red-tint);
  color: var(--red-text);
  font-weight: 500;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

/* A near miss (one-letter slip) is orange, like the footer banner. */
.cz-blank.is-close .cz-was {
  border-bottom-color: var(--orange);
  background: var(--orange-tint);
  color: var(--orange-text);
}

.cz-blank.is-wrong .cz-ans {
  border-bottom: 2px solid var(--green);
  background: var(--green-tint);
  color: var(--label);
}

@keyframes cz-pop {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}

@keyframes cz-in {
  from {
    opacity: 0;
    transform: translate3d(0, -6px, 0);
  }
}

/* Hints */
.cz-hints {
  margin-top: 16px;
}

.cz-hint-btn {
  gap: 6px;
  padding: 0 14px 0 12px;
}

.cz-hint-btn svg {
  width: 18px;
  height: 18px;
}

.cz-hint-btn::after {
  /* 44pt hit area */
  content: '';
  position: absolute;
  inset: -5px -2px;
}

.cz-callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding: 11px 14px;
  border-radius: var(--radius);
  background: var(--orange-tint);
  animation: cz-in 260ms var(--ease-out);
}

.cz-hint-btn[hidden] + .cz-callout {
  margin-top: 0;
}

.cz-callout > .icon {
  margin-top: 2px;
  color: var(--orange);
}

.cz-callout-text {
  min-width: 0;
  font-size: 16px;
  line-height: 22px;
  color: var(--label);
}

.cz-callout-text p {
  margin: 0;
}

.cz-callout-text p + p {
  margin-top: 4px;
}

.cz-callout-extra {
  font-weight: 600;
}

/* Reveal after checking */
.cz-reveal {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 0.5px solid var(--separator);
  animation: cz-in 280ms var(--ease-out);
}

.cz-vi {
  margin: 0 0 4px;
  font-size: 16px;
  line-height: 22px;
  color: var(--label-2);
}

.cz-word {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-bottom: -6px;
}

.cz-word-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
}

.cz-word-text {
  font-size: 17px;
  line-height: 22px;
  font-weight: 600;
}

.cz-speak {
  flex: none;
  margin-right: -8px;
}

.cz-sense {
  margin: 8px 0 0;
  font-size: 16px;
  line-height: 22px;
  color: var(--label);
  overflow-wrap: anywhere;
}

/* Word bank */
.cz-bank {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.cz-bank .chip {
  max-width: 100%;
  padding: 0 18px;
}

.cz-bank .chip.right:disabled,
.cz-bank .chip.wrong:disabled {
  opacity: 1;
}

/* Typed answer */
.cz-field {
  margin-top: 16px;
}

@media (max-width: 360px) {
  .cz-card {
    padding: 18px 16px;
  }

  .cz-sentence {
    font-size: 20px;
    line-height: 28px;
  }

  .cz-bank .chip {
    padding: 0 14px;
  }
}
