/* Presentation only. Welcome, spoken-only exams and literacy retain their
   existing layouts and answer-visibility rules. No scoring or voice changes. */
#voicePopup :is(.voice-popup-utility, .voice-popup-commandbar, .voice-popup-response, .voice-popup-feedback) {
  display: contents;
}
#voicePopup .voice-popup-preference { margin-bottom: .5rem; }

#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) {
  --review-good: #216e39;
  --review-bad: #af3043;
  --review-note: #805b13;
}
body.theme-dark #voicePopup {
  --review-good: #9ae6b1;
  --review-bad: #ffacb8;
  --review-note: #f2d18b;
}

#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-card {
  container-name: voice-console;
  container-type: inline-size;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  animation: none;
  color: var(--text);
}
#voicePopup.speaking:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-card {
  border-color: var(--primary);
}

#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-utility {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  min-height: 28px;
  margin: 0 88px 6px 0;
  color: var(--muted);
  font-size: .78rem;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) :is(.voice-popup-preference, .voice-popup-info) {
  margin: 0;
  font-size: inherit;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-info[open] { flex-basis: 100%; }
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) #popupExitBtn {
  top: 10px;
  right: 10px;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  border-radius: 8px;
  box-shadow: none;
}

#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
  gap: 6px;
  padding-right: 0;
  margin-bottom: 6px;
}
/* Maximized height is owned by app.css; compact only the content inside it. */
/* Keep the secondary resize control beside Close, not on its own empty row. */
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .popup-corner-tools {
  position: absolute;
  top: 10px;
  right: 50px;
  margin: 0;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) #popupCornerResizeBtn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 5px;
  border-radius: 8px;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-head {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  min-width: 0;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-heading-row { gap: 6px 10px; min-width: 0; }
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-citizenship-brand { order: -1; }
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-heading-row .voice-popup-label { display: none; }
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-state { margin: 0; font-size: .78rem; }
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) #practiceSilenceNotice { flex-basis: 100%; }
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) :is(.voice-popup-learner, .voice-popup-exam-type) {
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 7px;
  font-size: .78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-commandbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-actions { justify-content: flex-start; gap: 6px; }
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-actions .btn:where(:not(#popupExitBtn)) {
  min-height: 34px;
  padding: 5px 9px;
  border-radius: 8px;
  font-size: .8rem;
  line-height: 1.35;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-progress {
  flex-basis: auto;
  gap: 6px;
  margin: 0;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-progress > span {
  padding: 4px 7px;
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-pass-progress {
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr) auto;
  align-items: center;
  gap: 6px 12px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 9px;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-pass-progress-head {
  gap: 10px;
  margin: 0;
  font-size: .72rem;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-pass-progress-head strong {
  font-size: .9rem;
  font-variant-numeric: tabular-nums;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-pass-progress-meta {
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 0;
  font-size: .75rem;
}

#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-response {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-activity {
  flex: 0 0 38px;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  margin: 0;
  overflow: hidden;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-activity span { width: 5px; }
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-spoken {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-feedback {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-feedback:not(:has(> :not(.d-none))) { display: none; }
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) :is(.voice-popup-user-answer, .voice-popup-answer, .voice-popup-explanation) {
  min-width: 0;
  margin: 0;
  padding: 8px 10px;
  border-radius: 9px;
  overflow-wrap: anywhere;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) :is(.voice-popup-user-answer > span, .voice-popup-answer > span, .voice-popup-explanation > span) {
  margin: 0;
  font-size: .72rem;
  letter-spacing: .04em;
  font-weight: 750;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) :is(.voice-popup-user-answer > small, .voice-popup-answer > strong) {
  margin-top: 4px;
  font-size: .96rem;
  line-height: 1.4;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) :is(.voice-popup-answer > span, .voice-popup-answer > strong, .voice-popup-user-answer.is-correct) { color: var(--review-good); }
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-user-answer.is-incorrect { color: var(--review-bad); }
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-explanation { margin-bottom: 8px; }
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-explanation > span { color: var(--review-note); }
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-explanation p { margin-top: 4px; font-size: .88rem; line-height: 1.45; }
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) #voicePopupExplanationTranslation { font-size: .82rem; line-height: 1.4; }
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-translated { font-size: .95rem; line-height: 1.45; }
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-metrics { margin-top: 8px; padding-top: 8px; }

/* Use the installed vector icons with each control's semantic color. */
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) i.fa-solid {
  background: none !important;
  -webkit-text-fill-color: currentColor !important;
  color: inherit;
  filter: none;
}
#voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-citizenship-brand i {
  width: 24px;
  height: 24px;
  color: var(--primary);
  box-shadow: none;
}
body.theme-dark #voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) :is(.voice-popup-exam-type, .voice-popup-progress > span, .voice-popup-pass-progress) {
  background: var(--bg);
  border-color: var(--border);
  color: var(--muted);
}
body.theme-dark #voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) :is(.voice-popup-progress strong, .voice-popup-pass-progress-meta strong) { color: var(--text); }
body.theme-dark #voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) :is(.voice-popup-pass-progress-head, .voice-popup-pass-progress-head strong, #voicePopupTimer) { color: var(--primary); }
body.theme-dark #voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-pass-track { background: #26354d; }
body.theme-dark #voicePopup .voice-popup-pass-progress.target-reached :is(.voice-popup-pass-progress-head strong, .voice-popup-pass-progress-meta strong) { color: var(--review-good); }
body.theme-dark #voicePopup .voice-popup-pass-progress.target-failed :is(.voice-popup-pass-progress-head strong, .voice-popup-pass-progress-meta strong) { color: var(--review-bad); }

/* Respond to the resizable console, not just the browser viewport. */
@container voice-console (max-width: 640px) {
  #voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-commandbar { flex-direction: column; align-items: flex-start; }
  #voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-pass-progress { grid-template-columns: auto minmax(60px, 1fr); }
  #voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-pass-progress-meta { grid-column: 1 / -1; }
  #voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-feedback { grid-template-columns: minmax(0, 1fr); }
}
@media (pointer: coarse) {
  #voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-utility { min-height: 44px; margin-right: 112px; }
  #voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .voice-popup-actions .btn { min-height: 44px; }
  #voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) #popupExitBtn { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
  #voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) .popup-corner-tools { right: 62px; }
  #voicePopup:not(.exam-welcome, .study-welcome, .exam-voice-only, .exam-literacy-workstation) #popupCornerResizeBtn { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
}
