/* LearnDash layer 4/6: quiz UI (WP Pro Quiz inside LD30). See base.css for the cascade strategy. */
.learndash-wrapper .wpProQuiz_content {
	.wpProQuiz_question_text[tabindex="-1"]:focus { outline: none; } /* focus target after a question switch (quiz.js), not a control */
	.wpProQuiz_question_page { color: var(--wp--preset--color--muted); font-size: var(--wp--preset--font-size--x-small); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-block-end: .5rem; }
	.wpProQuiz_question_text, .wpProQuiz_question_text p { font-size: var(--wp--preset--font-size--large); font-weight: 600; line-height: 1.4; color: var(--wp--preset--color--heading); margin-block-end: 1rem; }
	ul.wpProQuiz_questionList { display: grid; gap: .75rem; padding: 0; margin: 0 0 1.5rem; list-style: none; }
	.wpProQuiz_questionListItem { margin: 0; padding: 0; background: none; border: 0; color: var(--wp--preset--color--contrast); }
	.wpProQuiz_questionListItem label {
		display: flex; align-items: center; gap: .85rem; margin: 0; padding: 1rem 1.25rem; min-block-size: 3.25rem; cursor: pointer;
		background: var(--wp--preset--color--surface-raised); border: 1px solid var(--wp--preset--color--border-strong); border-radius: var(--wp--custom--radius--md);
		box-shadow: var(--wp--preset--shadow--sm); font-size: var(--wp--preset--font-size--medium); line-height: 1.45;
		min-inline-size: 0; overflow-wrap: anywhere; hyphens: auto; /* long German compounds wrap inside the option at 320px */
	}
	.wpProQuiz_questionListItem label:hover { border-color: var(--wp--preset--color--accent); }
	.wpProQuiz_questionListItem label.is-selected { border-color: var(--wp--preset--color--link); }
	.wpProQuiz_questionListItem label:has(input:checked) { border-color: var(--wp--preset--color--accent); background: var(--wp--preset--color--info-bg); box-shadow: inset 0 0 0 1px var(--wp--preset--color--accent); }
	.wpProQuiz_questionListItem label:focus-within { border-color: var(--wp--preset--color--link); }
	/* Inset ring (SPEC: -3px where a container clips): the plugin's list is overflow:auto and as wide as the options. */
	.wpProQuiz_questionListItem label:has(input:focus-visible) { outline: 3px solid var(--wp--preset--color--focus); outline-offset: -3px; }
	ul.wpProQuiz_questionList input.wpProQuiz_questionInput { inline-size: 1.15rem; block-size: 1.15rem; flex: none; margin: 0; position: static; opacity: 1; accent-color: var(--wp--preset--color--primary); }
	.wpProQuiz_correct { background: var(--wp--preset--color--success-bg); color: var(--wp--preset--color--contrast); }
	.wpProQuiz_incorrect { background: var(--wp--preset--color--danger-bg); color: var(--wp--preset--color--contrast); }
	.wpProQuiz_results, .wpProQuiz_sending { background: var(--wp--preset--color--surface-raised); border: 1px solid var(--wp--preset--color--border); border-radius: var(--wp--custom--radius--lg); padding: 1.5rem; box-shadow: var(--wp--preset--shadow--sm); }
	.wpProQuiz_header { color: var(--wp--preset--color--heading); }
	/* "Richtig/Falsch": LD's fixed light-grey frame glared in dark; only the tinted inner banner remains. */
	.wpProQuiz_response { background: transparent; border: 0; padding: 0; box-shadow: none; }
	.wpProQuiz_response :is(.wpProQuiz_correct, .wpProQuiz_incorrect) { border-radius: var(--wp--custom--radius--md); padding: 1rem 1.25rem; }
	:where(input[type="text"], input[type="number"], textarea, select) { background: var(--wp--preset--color--base); color: var(--wp--preset--color--contrast); border: 1px solid var(--wp--preset--color--border-strong); border-radius: var(--wp--custom--radius--sm); }
}
.learndash-wrapper .wpProQuiz_quiz .wpProQuiz_time_limit .wpProQuiz_progress { background: var(--wp--preset--color--accent); }

/* Buttons: the single source for every quiz button (base.css no longer touches .wpProQuiz_button). Sizes, weights and
   the hover / pressed / disabled looks are the shared button tokens of assets/css/components.css.
   Shape and type: normal cascade (boost tier). */
.learndash-wrapper:not(.sddsg-b) .wpProQuiz_content {
	:is(input.wpProQuiz_button, .wpProQuiz_button, .wpProQuiz_QuestionButton) {
		box-sizing: border-box; min-block-size: var(--sddsg-btn-h); padding-block: 0.5rem; padding-inline: 1.75rem; border: 0; border-radius: var(--wp--custom--radius--pill, 999px);
		background-color: var(--wp--preset--color--accent); color: var(--wp--preset--color--on-accent);
		font-size: var(--sddsg-btn-size); font-weight: var(--sddsg-btn-weight); line-height: 1.2; text-align: center; white-space: nowrap; cursor: pointer;
	}
	:is(.wpProQuiz_button, .wpProQuiz_QuestionButton):disabled { opacity: var(--sddsg-disabled-opacity); cursor: not-allowed; filter: none; box-shadow: none; }
	@media (max-width: 640px) { :is(input.wpProQuiz_button, .wpProQuiz_button, .wpProQuiz_QuestionButton):not([style*="display: none"]) { inline-size: 100%; } }
}
/* Colours of the primary quiz buttons: LearnDash's own inline colour CSS forces a navy background with !important on
   `.wpProQuiz_content .wpProQuiz_button:not(.…reShowQuestion):not(.…restartQuiz)` (0,5,0), printed after every stylesheet,
   so this one block needs the strong tier + !important (a LearnDash constraint, not a theme workaround). */
.learndash-wrapper:not(#_) .wpProQuiz_content {
	.wpProQuiz_button:not(.wpProQuiz_button_reShowQuestion):not(.wpProQuiz_button_restartQuiz):not([name="back"]) {
		background-color: var(--wp--preset--color--accent) !important; color: var(--wp--preset--color--on-accent) !important; box-shadow: var(--sddsg-btn-edge);
		&:is(:hover, :focus-visible) { background-color: var(--wp--preset--color--accent) !important; color: var(--wp--preset--color--on-accent) !important; filter: var(--sddsg-btn-hover); box-shadow: var(--sddsg-btn-shadow-hover); }
	}
}

/* ---- Answer review (after "check"/at the end): readable states, colour + icon (not colour alone) ----
   LD paints correct labels green with white text; our light label background kept the white text (unreadable). */
.learndash-wrapper:not(#_) .wpProQuiz_content .wpProQuiz_questionListItem {
	&:is(.wpProQuiz_answerCorrect, .wpProQuiz_answerIncorrect, .wpProQuiz_answerCorrectIncomplete) { background: transparent !important; font-weight: inherit; }
	&:is(.wpProQuiz_answerCorrect, .wpProQuiz_answerIncorrect, .wpProQuiz_answerCorrectIncomplete) label {
		position: relative; padding-inline-end: 3rem !important; color: var(--wp--preset--color--contrast) !important; box-shadow: none;
	}
	&:is(.wpProQuiz_answerCorrect, .wpProQuiz_answerIncorrect, .wpProQuiz_answerCorrectIncomplete) label::after {
		content: ""; position: absolute; inset-inline-end: 1rem; inset-block-start: 50%; inline-size: 1.25rem; block-size: 1.25rem; transform: translateY(-50%);
		background: currentColor; -webkit-mask: var(--sddsg-quiz-icon) center / contain no-repeat; mask: var(--sddsg-quiz-icon) center / contain no-repeat;
	}
	&.wpProQuiz_answerCorrect label {
		background: var(--wp--preset--color--success-bg) !important; border-color: var(--wp--preset--color--success) !important;
		--sddsg-quiz-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12.5l5 5L20 6.5'/%3E%3C/svg%3E");
	}
	&.wpProQuiz_answerCorrect label::after, &.wpProQuiz_answerCorrectIncomplete label::after { color: var(--wp--preset--color--success); }
	&.wpProQuiz_answerIncorrect label {
		background: var(--wp--preset--color--danger-bg) !important; border-color: var(--wp--preset--color--danger) !important;
		--sddsg-quiz-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
	}
	&.wpProQuiz_answerIncorrect label::after { color: var(--wp--preset--color--danger); }
	&.wpProQuiz_answerCorrectIncomplete label {
		background: var(--wp--preset--color--surface-raised) !important; border: 2px dashed var(--wp--preset--color--success) !important;
		--sddsg-quiz-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12.5l5 5L20 6.5'/%3E%3C/svg%3E");
	}
}

/* ---- Certificate link at the end ("Ihr Zertifikat drucken"): primary gold button (LD's btn-blue got navy text on navy) ---- */
.learndash-wrapper:not(#_) .wpProQuiz_content .wpProQuiz_certificate a.btn-blue {
	display: inline-flex; align-items: center; justify-content: center; gap: .5rem; box-sizing: border-box; min-block-size: var(--sddsg-btn-h); padding: .5rem 1.75rem;
	background: var(--wp--preset--color--accent) !important; color: var(--wp--preset--color--on-accent) !important; border: 0; border-radius: var(--wp--custom--radius--pill, 999px);
	font-size: var(--sddsg-btn-size); font-weight: var(--sddsg-btn-weight); line-height: 1.2; text-decoration: none; text-transform: none; box-shadow: var(--sddsg-btn-edge);
	&:is(:hover, :focus-visible) { filter: var(--sddsg-btn-hover); box-shadow: var(--sddsg-btn-shadow-hover); }
}

/* ---- Zurück / Weiter: same chevrons as the lesson buttons (inputs: no pseudo elements -> background SVG) ---- */
.learndash-wrapper:not(#_) .wpProQuiz_content {
	input.wpProQuiz_button[name="next"] {
		padding-inline: 1.75rem 2.75rem !important; background-repeat: no-repeat !important; background-position: right 1.25rem center !important; background-size: 1rem !important;
		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231b2b3e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5l7 7-7 7'/%3E%3C/svg%3E") !important;
	}
	input.wpProQuiz_button[name="back"] {
		padding-inline: 2.75rem 1.75rem !important; background-repeat: no-repeat !important; background-position: left 1.25rem center !important; background-size: 1rem !important;
		background-image: var(--sddsg-quiz-chevron-back) !important;
	}
}

/* ---- Answer controls: custom-drawn. Native radios/checkboxes under color-scheme: dark render as grey filled discs that look disabled/selected. ---- */
.learndash-wrapper .wpProQuiz_content ul.wpProQuiz_questionList input.wpProQuiz_questionInput:is([type="radio"], [type="checkbox"]) {
	-webkit-appearance: none; appearance: none; box-sizing: border-box; inline-size: 1.25rem; block-size: 1.25rem; cursor: pointer;
	border: 2px solid var(--wp--preset--color--border-strong); background: transparent no-repeat center / 100% 100%;
	outline: none; /* focus ring is drawn on the label (label:has(input:focus-visible)) */
	&[type="radio"] { border-radius: 50%; }
	&[type="checkbox"] { border-radius: var(--sddsg-check-radius); }
	&:checked { border-color: var(--wp--preset--color--primary); }
	&[type="radio"]:checked { background-image: radial-gradient(circle, var(--wp--preset--color--primary) 0 42%, transparent 46%); }
	&[type="checkbox"]:checked {
		background-color: var(--wp--preset--color--primary);
		/* check mark in on-primary: masks are not available on inputs, so two strokes as gradients would be fragile -> SVG per scheme below */
		background-image: var(--sddsg-quiz-check);
	}
	&:disabled { cursor: default; }
}
.learndash-wrapper .wpProQuiz_content { --sddsg-quiz-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); --sddsg-quiz-chevron-back: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d405e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 5l-7 7 7 7'/%3E%3C/svg%3E"); }
/* dark: primary is gold, the mark must be dark (same ink as the chevrons above) */
:root[data-theme="dark"] .learndash-wrapper .wpProQuiz_content { --sddsg-quiz-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230a1322' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); --sddsg-quiz-chevron-back: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e8eff8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 5l-7 7 7 7'/%3E%3C/svg%3E"); }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .learndash-wrapper .wpProQuiz_content { --sddsg-quiz-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230a1322' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); --sddsg-quiz-chevron-back: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e8eff8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 5l-7 7 7 7'/%3E%3C/svg%3E"); }
}

/* ---- Focus / hover of all quiz buttons: LD fades them to opacity .75/.85 and removes the outline, which reads as "disabled".
   Full opacity + the theme's standard focus ring. Disabled buttons keep their own .5 (rule above). ---- */
.learndash-wrapper:not(#_) .wpProQuiz_content {
	:is(input.wpProQuiz_button, .wpProQuiz_button, .wpProQuiz_QuestionButton, .wpProQuiz_certificate a.btn-blue, #quiz_continue_link):not(:disabled):is(:hover, :focus, :active) { opacity: 1; }
	:is(input.wpProQuiz_button, .wpProQuiz_button, .wpProQuiz_QuestionButton, .wpProQuiz_certificate a.btn-blue, #quiz_continue_link):focus-visible { outline: var(--sddsg-ring); outline-offset: var(--sddsg-ring-offset); }
}

/* ---- Result card ---- */
/* Score box / time: LD's fixed light grey + grey text (3.6:1) -> tokens. */
.learndash-wrapper .wpProQuiz_content .wpProQuiz_results {
	.wpProQuiz_points, .wpProQuiz_graded_points { background: var(--wp--preset--color--surface); border: 1px solid var(--wp--preset--color--border); border-radius: var(--wp--custom--radius--md); color: var(--wp--preset--color--contrast); }
	.wpProQuiz_quiz_time, .wpProQuiz_time_limit_expired { color: var(--wp--preset--color--muted); }
}
/* Actions: LD's nowrap row overflowed the card at 390 (buttons cut at the screen edge, no gap). Wrap with a gap; phones: stacked, full width. */
.learndash-wrapper .wpProQuiz_content .ld-quiz-actions {
	display: flex; flex-flow: row wrap; align-items: center; justify-content: flex-start; gap: 0.75rem; /* row: LD's row-reverse showed another order than phones and the tab order */
	border-block-start: 1px solid var(--wp--preset--color--border); /* LD: fixed light grey, glared in dark */
	> * { margin: 0 !important; float: none; }
	> .quiz_continue_link:not(:has(a)) { display: none !important; } /* empty placeholder must not take a gap */
	@media (max-width: 640px) {
		flex-direction: column; align-items: stretch;
		> * { inline-size: 100%; max-inline-size: 100%; }
	}
}
/* "Weiter zum Kurs": the primary action after the quiz -> the portal's primary button (LD's custom navy stayed navy on the dark card, 1.4:1). */
.learndash-wrapper:not(#_) .wpProQuiz_content .ld-quiz-actions #quiz_continue_link {
	display: flex; align-items: center; justify-content: center; box-sizing: border-box; inline-size: 100%; min-block-size: var(--sddsg-btn-h); margin: 0; padding: 0.5rem 1.75rem;
	background-color: var(--wp--preset--color--accent) !important; color: var(--wp--preset--color--on-accent) !important; box-shadow: var(--sddsg-btn-edge);
	border: 0; border-radius: var(--wp--custom--radius--pill, 999px); font-size: var(--sddsg-btn-size); font-weight: var(--sddsg-btn-weight); line-height: 1.2; text-align: center; text-decoration: none;
	&:is(:hover, :focus-visible) { background-color: var(--wp--preset--color--accent) !important; filter: var(--sddsg-btn-hover); box-shadow: var(--sddsg-btn-shadow-hover); }
}

/* ---- Hierarchy: one primary action per screen (QUZ-01, QUZ-10) ----
   Secondary = the portal's outline button on the card surface, in both schemes. !important + strong tier because
   LearnDash's inline colour CSS forces navy with !important on "Zurück" (rest) and on the hover of restart / review. */
.learndash-wrapper:not(#_) .wpProQuiz_content {
	:is(input.wpProQuiz_button[name="back"], .ld-quiz-actions .wpProQuiz_button_restartQuiz, .ld-quiz-actions .wpProQuiz_button_reShowQuestion) {
		background-color: var(--wp--preset--color--surface-raised) !important; color: var(--wp--preset--color--heading) !important;
		border: var(--sddsg-btn-border) solid var(--sddsg-btn2-border); box-shadow: none; filter: none; font-weight: var(--sddsg-btn2-weight);
		&:is(:hover, :focus-visible, :active) { background-color: var(--sddsg-btn2-bg-hover) !important; color: var(--wp--preset--color--heading) !important; border-color: var(--sddsg-btn2-border-hover); box-shadow: none; filter: none; }
		&:active { background-color: var(--sddsg-btn2-bg-press) !important; }
	}
	/* not passed: retry is the way on */
	&.sddsg-quiz-is-failed .ld-quiz-actions .wpProQuiz_button_restartQuiz {
		background-color: var(--wp--preset--color--accent) !important; color: var(--wp--preset--color--on-accent) !important; border-color: transparent; font-weight: var(--sddsg-btn-weight); box-shadow: var(--sddsg-btn-edge);
		&:is(:hover, :focus-visible, :active) { background-color: var(--wp--preset--color--accent) !important; color: var(--wp--preset--color--on-accent) !important; border-color: transparent; filter: var(--sddsg-btn-hover); box-shadow: var(--sddsg-btn-shadow-hover); }
	}
	/* passed: "continue" + certificate on the first line, retry / review below (same order as the DOM, so tab order = visual order) */
	&.sddsg-quiz-is-passed .ld-quiz-actions::before { content: ""; order: 2; flex: 0 0 100%; block-size: 0; margin-block: -0.375rem; }
	&.sddsg-quiz-is-passed .ld-quiz-actions > :is(.quiz_continue_link, .wpProQuiz_certificate) { order: 1; }
	&.sddsg-quiz-is-passed .ld-quiz-actions > :is(.wpProQuiz_button_restartQuiz, .wpProQuiz_button_reShowQuestion) { order: 3; }
	/* certificate: second action after "continue" (quiz.js moves it into the action row) */
	.ld-quiz-actions .wpProQuiz_certificate { display: flex; }
	.ld-quiz-actions .wpProQuiz_certificate a.btn-blue {
		inline-size: 100%; background: var(--wp--preset--color--surface-raised) !important; color: var(--wp--preset--color--heading) !important; font-weight: var(--sddsg-btn2-weight);
		border: var(--sddsg-btn-border) solid var(--sddsg-btn2-border) !important; box-shadow: none; /* !important: LD removes the bottom border of links */
		&:is(:hover, :focus-visible) { background: var(--sddsg-btn2-bg-hover) !important; border-color: var(--sddsg-btn2-border-hover) !important; filter: none; box-shadow: none; }
	}
}
/* Phones: "Zurück" (compact, left) and "Weiter" (wide, right) in one row instead of two stacked full-width pills with "Zurück" on top. */
@media (max-width: 640px) {
	.learndash-wrapper:not(#_) .wpProQuiz_content .wpProQuiz_list > .wpProQuiz_listItem:has(> input[name="next"]) {
		display: flex; flex-wrap: wrap; align-items: stretch; gap: 0.75rem;
		> * { flex: 0 0 100%; min-inline-size: 0; max-inline-size: 100%; margin-inline: 0 !important; }
		> div[style*="clear"]:empty { display: none; }
		> input[name="back"] { order: 1; flex: 0 0 auto; inline-size: auto; }
		> input[name="next"] { order: 2; flex: 1 1 8rem; inline-size: auto; }
	}
}
/* Pressed feedback for the primary quiz actions (hover and pressed looked the same). */
.learndash-wrapper:not(#_) .wpProQuiz_content :is(.wpProQuiz_button:not(.wpProQuiz_button_reShowQuestion):not(.wpProQuiz_button_restartQuiz):not([name="back"]), .sddsg-quiz-is-failed .ld-quiz-actions .wpProQuiz_button_restartQuiz, .ld-quiz-actions #quiz_continue_link):not(:disabled):active { filter: var(--sddsg-btn-press); box-shadow: var(--sddsg-btn-edge); }
.learndash-wrapper:not(#_) .wpProQuiz_content .ld-quiz-actions .wpProQuiz_certificate a.btn-blue:active { background: var(--sddsg-btn2-bg-press) !important; }
/* A11-09: "Der Abschlusstest wird geladen ..." - LearnDash paints a light box with grey text (3.6:1) in both schemes. Tokens instead. */
.learndash-wrapper:not(#_) .wpProQuiz_content .wpProQuiz_loadQuiz {
	background: var(--wp--preset--color--surface-raised); color: var(--wp--preset--color--contrast); border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--md); min-block-size: 0; padding-block: 1rem; /* LearnDash keeps room for its icon on the left */
}
.learndash-wrapper:not(#_) .wpProQuiz_content .wpProQuiz_loadQuiz p { color: inherit; font-weight: 600; }
