/* Passage Memory */
.passage-memory-game .mmc-phase[hidden] {
  display: none !important;
}

.passage-memory-game .mmc-phase {
  animation: mmc-fade-in 0.35s ease;
}

@keyframes mmc-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.passage-memory-game .mmc-timer-display {
  display: block;
  margin: 0 auto 12px;
  font-size: 2.25rem;
  font-weight: 800;
  text-align: center;
  color: var(--ink, #111827);
}

.passage-memory-game .mmc-timer-display.is-low {
  color: #dc2626;
}

.passage-memory-game .mmc-phase-label {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  color: var(--muted, #6b7280);
}

.passage-memory-game #mmcGameView:has(.mmc-memory-phase:not([hidden])) {
  display: flex;
  flex-direction: column;
  min-height: min(78vh, calc(100dvh - 200px));
}

.passage-memory-game .mmc-memory-phase:not([hidden]) {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.passage-memory-game .mmc-memory-phase-label {
  flex-shrink: 0;
  margin-bottom: 12px;
}

.passage-memory-game .mmc-memory-passage {
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

.passage-memory-game .mmc-memory-text {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  margin: 0;
  padding: 16px 20px;
  border: 2px solid var(--line, #e5e7eb);
  border-radius: 12px;
  background: var(--panel, #fff);
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink, #111827);
  white-space: pre-wrap;
}

.passage-memory-game .mmc-math-phase .mmc-math-timer-display {
  display: block;
  margin: 0 auto 12px;
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  color: #7c3aed;
}

.passage-memory-game .mmc-math-timer-display.is-math-low {
  color: #dc2626;
}

.passage-memory-game .mmc-math-eyebrow {
  color: #7c3aed;
}

.passage-memory-game .mmc-quiz-eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
}

.passage-memory-game .mmc-math-progress {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  color: #6b7280;
}

.passage-memory-game .mmc-math-feedback {
  margin: 12px 0 0;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  color: #6b7280;
}

.passage-memory-game .mmc-math-feedback.is-correct {
  color: #059669;
}

.passage-memory-game .mmc-math-feedback.is-wrong {
  color: #dc2626;
}

.passage-memory-game .mmc-math-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.passage-memory-game .mmc-math-card {
  max-width: 360px;
  margin: 0 auto;
  padding: 20px;
  border-radius: 12px;
  border: 2px solid var(--line, #e5e7eb);
  background: var(--panel, #f9fafb);
}

.passage-memory-game .mmc-math-prompt {
  margin: 0 0 16px;
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
}

.passage-memory-game .mmc-math-form {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.passage-memory-game .mmc-math-input {
  width: min(100%, 140px);
  padding: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  border: 2px solid var(--line, #e5e7eb);
  border-radius: 10px;
}

.passage-memory-game .mmc-math-stats {
  margin-top: 14px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  color: var(--muted, #6b7280);
}

.passage-memory-game .mmc-recall-card {
  max-width: 560px;
  margin: 0 auto;
}

.passage-memory-game .mmc-question-nav {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px;
  background: #fff;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.passage-memory-game .mmc-q-btn {
  flex: 0 0 auto;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border: 2px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  color: #374151;
  background: #e5e7eb;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.passage-memory-game .mmc-q-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.passage-memory-game .mmc-q-btn.is-current {
  border-color: #111827;
  box-shadow: 0 0 0 1px #111827;
}

.passage-memory-game .mmc-q-btn.is-pending,
.passage-memory-game .mmc-q-btn.is-skipped {
  background: #e5e7eb;
  color: #4b5563;
}

.passage-memory-game .mmc-q-btn.is-correct {
  background: #22c55e;
  color: #fff;
}

.passage-memory-game .mmc-q-btn.is-wrong {
  background: #ef4444;
  color: #fff;
}

.passage-memory-game .mmc-recall-feedback {
  margin: 0 0 12px;
  min-height: 1.25em;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  color: var(--muted, #6b7280);
}

.passage-memory-game .mmc-recall-feedback.is-good {
  color: #059669;
}

.passage-memory-game .mmc-recall-feedback.is-bad {
  color: #dc2626;
}

.passage-memory-game button.mmc-choice.is-selected {
  border-color: #0891b2;
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.2);
}

.passage-memory-game .mmc-recall-prompt {
  margin: 0 0 16px;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.5;
}

.passage-memory-game .mmc-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.passage-memory-game button.mmc-choice {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 12px;
  border: 2px solid var(--line, #e5e7eb);
  border-radius: 12px;
  background: var(--panel, #f9fafb);
  color: var(--ink, #111827);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.passage-memory-game button.mmc-choice:hover:not(:disabled) {
  background: #fff;
  border-color: #0891b2;
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
}

.passage-memory-game button.mmc-choice:disabled {
  cursor: default;
  opacity: 1;
}

.passage-memory-game button.mmc-choice.is-correct {
  border-color: #059669;
  background: #ecfdf5;
}

.passage-memory-game button.mmc-choice.is-wrong {
  border-color: #dc2626;
  background: #fef2f2;
}

.mmc-choice-key {
  display: inline-flex;
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 6px;
  background: #ecfeff;
  color: #0e7490;
  font-size: 12px;
  font-weight: 800;
}

.mmc-choice-value {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
}

.passage-memory-game .mmc-recall-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 8px;
}

.passage-memory-game .mmc-recall-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted, #6b7280);
}

.passage-memory-game .mmc-recall-score {
  text-align: right;
}

.passage-memory-game .mmc-ready-note {
  text-align: center;
  max-width: 480px;
  margin: 0 auto 20px;
  color: var(--muted, #6b7280);
  line-height: 1.5;
}

/* .dev-footer-actions sets display:flex and overrides the [hidden] attribute */
.passage-memory-game #mmcFooterActions[hidden] {
  display: none !important;
}
