/* Belcanto Lab V38.2: readable theory and quiz text in every theme state */
html[data-theme="light"] :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) .quiz-head h3,
body.theme-light :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) .quiz-head h3,
html[data-theme="light"] :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) :is(.quiz-question,fieldset)>legend,
body.theme-light :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) :is(.quiz-question,fieldset)>legend,
html[data-theme="light"] :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) :is(.quiz-question,fieldset)>legend *,
body.theme-light :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) :is(.quiz-question,fieldset)>legend *{
  color:#111827!important;
  -webkit-text-fill-color:#111827!important;
  opacity:1!important;
  font-weight:800!important;
  text-shadow:none!important;
}
html[data-theme="light"] :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) :is(.quiz-question,fieldset)>legend,
body.theme-light :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) :is(.quiz-question,fieldset)>legend{
  line-height:1.45!important;
}
html[data-theme="light"] :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) :is(.quiz-question,fieldset)>legend>span,
body.theme-light :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) :is(.quiz-question,fieldset)>legend>span{
  color:#4b3621!important;
  -webkit-text-fill-color:#4b3621!important;
  background:#f7f0e4!important;
  border:1px solid #d2c1a7!important;
  opacity:1!important;
}
html[data-theme="light"] :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) :is(.quiz-head p,.quiz-option,.quiz-result,.quiz-explain),
body.theme-light :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) :is(.quiz-head p,.quiz-option,.quiz-result,.quiz-explain){
  color:#374151!important;
  -webkit-text-fill-color:#374151!important;
  opacity:1!important;
  text-shadow:none!important;
}
html[data-theme="light"] :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) .quiz-option,
body.theme-light :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) .quiz-option{
  background:#ffffff!important;
  border-color:#cbd5e1!important;
}
html[data-theme="light"] :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) .quiz-option:hover,
html[data-theme="light"] :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) .quiz-option:focus-within,
body.theme-light :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) .quiz-option:hover,
body.theme-light :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) .quiz-option:focus-within{
  color:#111827!important;
  -webkit-text-fill-color:#111827!important;
  border-color:#2563a6!important;
  background:#eff6ff!important;
}
html[data-theme="light"] :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) .quiz-option:has(input:checked),
body.theme-light :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) .quiz-option:has(input:checked){
  color:#111827!important;
  -webkit-text-fill-color:#111827!important;
  border-color:#1d4f91!important;
  background:#e7f2ff!important;
  font-weight:650!important;
}
html[data-theme="light"] :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) :is(.quiz-option,[disabled],.disabled),
body.theme-light :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) :is(.quiz-option,[disabled],.disabled){
  opacity:1!important;
}
html[data-theme="light"] :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) .quiz-option input,
body.theme-light :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) .quiz-option input{
  filter:none!important;
  opacity:1!important;
  accent-color:#1d4f91!important;
}
html[data-theme="light"] :is(.theory-reading,.theory-reading p,.theory-action-grid strong,.theory-footer span),
body.theme-light :is(.theory-reading,.theory-reading p,.theory-action-grid strong,.theory-footer span){
  color:#273444!important;
  -webkit-text-fill-color:#273444!important;
  opacity:1!important;
}
html[data-theme="dark"] :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) :is(.quiz-question,fieldset)>legend,
html[data-theme="dark"] :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) :is(.quiz-question,fieldset)>legend *{
  color:#f8fafc!important;
  -webkit-text-fill-color:#f8fafc!important;
  opacity:1!important;
  font-weight:800!important;
}
html[data-theme="dark"] :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) .quiz-option{
  color:#e5e7eb!important;
  -webkit-text-fill-color:#e5e7eb!important;
  opacity:1!important;
}
@media (prefers-contrast:more){
  html[data-theme="light"] :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) :is(.quiz-question,fieldset)>legend,
  body.theme-light :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) :is(.quiz-question,fieldset)>legend{color:#000!important;-webkit-text-fill-color:#000!important}
  html[data-theme="light"] :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) .quiz-option,
  body.theme-light :is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) .quiz-option{color:#111!important;-webkit-text-fill-color:#111!important;border-color:#6b7280!important}
}

/* V38.2 final: stronger quiz hierarchy after full-language review */
:is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) .quiz-head h3{
  color:var(--text)!important;
  -webkit-text-fill-color:var(--text)!important;
  opacity:1!important;
  font-weight:800!important;
}
:is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) .quiz-question>legend{
  font-size:15px!important;
  line-height:1.5!important;
  letter-spacing:0!important;
}
:is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) .quiz-option{
  font-size:13px!important;
  line-height:1.55!important;
}
:is(.theory-quiz-card,#theoryQuizModal,.quiz-modal) .quiz-option>span{
  color:inherit!important;
  -webkit-text-fill-color:inherit!important;
  opacity:1!important;
}
