.tbb-qb-app {
	--tbb-qb-primary: #D14E4E;
	--tbb-qb-accent: #F0C24B;
	--tbb-qb-dark: #1D1D1D;
	--tbb-qb-bg: #FFFFFF;
	--tbb-qb-card: #FFFFFF;
	--tbb-qb-radius: 16px;
	--tbb-qb-highlight-bg: #FFFFFF;
	--tbb-qb-highlight-border: #D14E4E;
	--tbb-qb-results-width: 900px;
	display: block;
	/* Block themes clamp the direct children of a "constrained layout"
	   content area to the theme's own prose width via a rule like
	   ".is-layout-constrained > :where(...)" - that :where() carries zero
	   specificity, but it still wins on source order in many themes, and
	   it caps the quiz well below the widths this app sets for itself
	   below (max-width: none is enough to escape it; nothing here needs to
	   exceed the page's own content column). The !important is deliberate:
	   this fights a stylesheet we don't own and can't predict per-theme,
	   not a shortcut around our own specificity.
	*/
	max-width: none !important;
	/* Without this, whatever the editor/theme places right after the quiz
	   (another block, a CTA row, etc.) sits flush against the results
	   section's own background/border with no breathing room. */
	margin-bottom: 40px !important;
}

.tbb-qb-loading {
	padding: 40px;
	text-align: center;
	color: #757575;
}

.tbb-qb-section {
	background: var( --tbb-qb-bg );
	padding: 44px 20px 56px;
}

.tbb-qb-inner {
	max-width: 640px;
	margin: 0 auto;
}

.tbb-qb-card {
	background: var( --tbb-qb-card );
	border: 1px solid rgba( 0, 0, 0, 0.08 );
	border-radius: var( --tbb-qb-radius );
	padding: 32px;
	box-shadow: 0 10px 24px rgba( 0, 0, 0, 0.08 );
	text-align: center;
}

.tbb-qb-eyebrow {
	font-size: 0.9rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var( --tbb-qb-primary );
	margin-bottom: 10px;
}

.tbb-qb-card h2 {
	font-weight: 800;
	font-size: 1.5rem;
	color: var( --tbb-qb-dark );
	margin: 0 0 10px;
	line-height: 1.3;
}

/* Repeated class: this is a plain <p>, same theme-collision risk as the
   results-screen text fixed earlier (a more specific rule for paragraphs
   within the theme's own content wrapper otherwise wins) - and it's the
   reason this also needed an explicit text-align rather than continuing
   to inherit .tbb-qb-card's center alignment (which never matched the
   question title's own left alignment next to it). */
.tbb-qb-sub.tbb-qb-sub {
	font-size: 16px !important;
	color: #444444 !important;
	text-align: left !important;
	margin: 0 0 22px;
}

.tbb-qb-dots {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-bottom: 22px;
}

.tbb-qb-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #e7e7e7;
	display: inline-block;
}

.tbb-qb-dot.is-active {
	background: var( --tbb-qb-primary );
	width: 22px;
	border-radius: 4px;
}

.tbb-qb-question {
	font-weight: 700;
	font-size: 1.15rem;
	color: var( --tbb-qb-dark );
	margin-bottom: 18px;
	text-align: left;
}

.tbb-qb-options {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin-bottom: 24px;
}

@media ( max-width: 480px ) {
	.tbb-qb-options {
		grid-template-columns: 1fr;
	}
}

.tbb-qb-option {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	border: 1.5px solid #e7e7e7;
	border-radius: 10px;
	font-size: 0.9rem;
	font-weight: 600;
	color: var( --tbb-qb-dark );
	background: #fafafa;
	cursor: pointer;
	text-align: left;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.tbb-qb-option:hover {
	border-color: var( --tbb-qb-primary );
}

.tbb-qb-option img {
	width: 32px;
	height: 32px;
	object-fit: cover;
	border-radius: 6px;
	flex-shrink: 0;
}

.tbb-qb-option.tbb-qb-picked {
	border-color: var( --tbb-qb-primary );
	background: color-mix( in srgb, var( --tbb-qb-primary ) 10%, white );
	color: var( --tbb-qb-primary );
}

.tbb-qb-text-input {
	width: 100%;
	padding: 12px 14px;
	border: 1.5px solid #e7e7e7;
	border-radius: 10px;
	font-size: 1rem;
	margin-bottom: 22px;
	box-sizing: border-box;
}

.tbb-qb-text-input.tbb-qb-error {
	border-color: var( --tbb-qb-primary );
}

.tbb-qb-consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 0.85rem;
	color: #5f5f5f;
	text-align: left;
	margin-bottom: 22px;
}

.tbb-qb-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.tbb-qb-nav {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	gap: 12px;
}

.tbb-qb-btn {
	display: inline-block;
	padding: 12px 26px;
	border-radius: 999px;
	font-weight: 700;
	font-size: 0.95rem;
	border: 2px solid transparent;
	cursor: pointer;
	text-align: center;
	/* The CTAs are real <a href> links (they go to an external site), and
	   many themes carry their own more specific selector for a link's color/
	   underline within the content area (e.g. ".entry-content a"), which
	   otherwise wins over a single class like .tbb-qb-btn-primary below -
	   on a theme with a reddish link color this can make white button text
	   blend into a similarly-reddish button background and disappear
	   entirely. Same reasoning as .tbb-qb-app's max-width !important above:
	   this fights a stylesheet we don't own, not our own specificity. */
	text-decoration: none !important;
}

/* .tbb-qb-btn-primary repeated: a theme can define its own link color/
   hover rule scoped to its content wrapper (e.g. ".post-content a" /
   ".post-content a:hover"), which - having one more selector component
   (the "a") - is MORE specific than a single class, even against
   !important on both sides (importance ties go to specificity, then
   source order, which we can't rely on winning). Repeating the class
   token adds a class-level match with no behavior change (an element
   either has "tbb-qb-btn-primary" or it doesn't - matching it twice
   changes nothing about which elements match) purely to outrank that
   pattern regardless of where the theme's stylesheet loads. */
.tbb-qb-btn-primary.tbb-qb-btn-primary {
	background: var( --tbb-qb-primary ) !important;
	color: #fff !important;
	border-color: var( --tbb-qb-primary ) !important;
}

.tbb-qb-btn-primary.tbb-qb-btn-primary:hover {
	/* Falls back to the plugin's own (non-hover) primary color when the
	   site theme's hover-red variable isn't defined, rather than an
	   invalid/no-op background. */
	background: var( --tbb-red-h, var( --tbb-qb-primary ) ) !important;
	color: #fff !important;
}

.tbb-qb-btn-primary:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.tbb-qb-btn-secondary.tbb-qb-btn-secondary {
	background: transparent !important;
	color: var( --tbb-qb-dark ) !important;
	border-color: #e7e7e7 !important;
}

/* Without this, a theme's own "a:hover" rule (see .tbb-qb-btn-primary:hover
   above) would still apply on hover here: the base rule above ties with
   it on specificity once the pseudo-class is added, and a tie doesn't
   reliably go our way. This isn't meant to look any different on
   hover - it's here purely to hold the color steady against that. */
.tbb-qb-btn-secondary.tbb-qb-btn-secondary:hover {
	color: var( --tbb-qb-dark ) !important;
}

.tbb-qb-btn-link {
	background: none;
	border: none;
	color: #757575;
	text-decoration: underline;
	cursor: pointer;
	font-size: 0.9rem;
	margin-right: auto;
}

.tbb-qb-results-inner {
	max-width: var( --tbb-qb-results-width );
}

.tbb-qb-results {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* Match badge - a small pill, distinct from the plain-text .tbb-qb-eyebrow
   used on the intro copy. */
.tbb-qb-match-badge {
	display: inline-block;
	background: var( --tbb-qb-primary );
	color: #fff;
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 4px 12px;
	border-radius: 999px;
	margin-bottom: 10px;
	/* Custom badge text (e.g. "Adventure Travel") can easily be wider than
	   the fixed-width image column it sits in - never wrap it into a
	   two-line pill, just let it overflow that column's notional width
	   (the column is centered, and the row's gap gives it room). */
	white-space: nowrap;
}

.tbb-qb-result-card {
	text-align: left;
	padding: 24px;
}

/* The #1 result, when "Highlight the top match" is on - colors come from
   the quiz's theme so they can be set per-quiz in the Design tab. Same
   specificity as .tbb-qb-card, so source order (this comes later) is what
   makes it win. */
.tbb-qb-result-highlighted {
	background: var( --tbb-qb-highlight-bg );
	border: 2px solid var( --tbb-qb-highlight-border );
}

/* ---- Standard / Compact / Minimal: a row per result, stacked as a list ---- */

.tbb-qb-result-row {
	display: flex;
	align-items: center;
	gap: 28px;
}

.tbb-qb-result-col-image {
	flex: 0 0 140px;
	/* A flex column, not relying on default inline flow: the badge
	   (inline-block) and the image (inline, and much taller) would
	   otherwise sit side-by-side on a shared baseline-aligned line instead
	   of stacking. */
	display: flex;
	flex-direction: column;
	align-items: center;
}

.tbb-qb-result-col-image img {
	width: 120px;
	height: 120px;
	object-fit: contain;
	border-radius: 8px;
}

.tbb-qb-result-col-info {
	flex: 1 1 auto;
	min-width: 0;
}

/* .tbb-qb-result-col-info repeated below: a theme's own typography rule
   scoped to its content wrapper (confirmed in the wild as e.g.
   ".post-content h3", ".post-content p") matches with the SAME
   specificity as this plain "ancestor-class element" selector - a tie,
   which is decided by source order and so isn't safe to depend on.
   Repeating the ancestor class adds a class-level match (matches exactly
   the same elements either way) to win outright instead. */
.tbb-qb-result-col-info.tbb-qb-result-col-info h3 {
	font-weight: 800;
	font-size: 1.2rem;
	color: var( --tbb-qb-dark );
	margin: 0 0 6px !important;
}

.tbb-qb-result-col-info.tbb-qb-result-col-info p {
	margin: 0 !important;
	color: var( --tbb-dark, #5f5f5f ) !important;
	font-size: 0.95rem !important;
	/* Clamped (3 lines) so a very long description can't make one row
	   wildly taller than its neighbours. Description and "Why this result"
	   are separate paragraphs, so each gets its own 3 lines. */
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	overflow: hidden;
}

/* "Why this match" text - visually distinct (italic, muted) from the
   plain description above it, in both the row layouts and the stacked
   Cards layout. One class beyond the (already repeated) rules above, so
   this still wins over them as well as over the theme. */
.tbb-qb-result-col-info.tbb-qb-result-col-info p.tbb-qb-result-why,
.tbb-qb-result-stack.tbb-qb-result-stack p.tbb-qb-result-why {
	font-style: italic !important;
	color: var( --tbb-grey, #8a8a8a ) !important;
	margin-top: 6px;
}

.tbb-qb-result-col-cta {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* Standard keeps a consistent minimum row height regardless of content. */
.tbb-qb-results-standard .tbb-qb-result-row {
	min-height: 120px;
}

/* Compact: same row shape, smaller image, tighter spacing, single-line
   description - for quizzes showing more results at once. */
.tbb-qb-results-compact .tbb-qb-result-card {
	padding: 14px 18px;
}

.tbb-qb-results-compact .tbb-qb-result-row {
	gap: 16px;
	min-height: 56px;
}

.tbb-qb-results-compact .tbb-qb-result-col-image {
	/* auto, not a fixed px, so it's sized by whichever is wider - the image
	   or the "MATCH #" badge - instead of the badge text wrapping. */
	flex: 0 0 auto;
}

.tbb-qb-results-compact .tbb-qb-result-col-image img {
	width: 56px;
	height: 56px;
}

.tbb-qb-results-compact .tbb-qb-match-badge {
	white-space: nowrap;
	font-size: 0.65rem;
	padding: 3px 10px;
	margin-bottom: 4px;
}

.tbb-qb-results-compact .tbb-qb-result-col-info h3 {
	font-size: 1rem;
	margin-bottom: 2px;
}

.tbb-qb-results-compact .tbb-qb-result-col-info p {
	-webkit-line-clamp: 1;
	font-size: 0.85rem;
}

/* Minimal: no image column at all, single-line everything. */
.tbb-qb-results-minimal .tbb-qb-result-card {
	padding: 14px 20px;
}

.tbb-qb-results-minimal .tbb-qb-result-row {
	min-height: 44px;
}

.tbb-qb-results-minimal .tbb-qb-result-col-info p {
	-webkit-line-clamp: 1;
	font-size: 0.85rem;
}

@media ( max-width: 640px ) {
	.tbb-qb-result-row {
		flex-direction: column;
		text-align: center;
	}

	.tbb-qb-result-col-info,
	.tbb-qb-result-col-info p {
		text-align: center;
	}

	.tbb-qb-result-col-cta {
		width: 100%;
	}

	.tbb-qb-result-col-cta .tbb-qb-btn {
		display: block;
	}
}

/* ---- Cards: results side-by-side, each its own vertical card ---- */

.tbb-qb-results-cards {
	display: grid;
	/* Column count is set inline per-render (min(result count, 4)) so up to
	   4 results always share one row and fill its width; a 5th+ result
	   wraps to a second row of up to 4 rather than shrinking every column.
	   This is a static fallback for the rare case JS hasn't set it. */
	grid-template-columns: repeat( auto-fit, minmax( 200px, 1fr ) );
	gap: 16px;
	/* Grid items in the same row stretch to equal height by default, which
	   is exactly what keeps every card the same height here. */
}

/* The results grid also holds the Retake / Report links and the small print
   (they're appended to the same container as the cards). Without this each
   one landed in whichever grid cell was free, scattered across the row
   instead of centered underneath - so span every column. */
.tbb-qb-results-cards > .tbb-qb-retake,
.tbb-qb-results-cards > .tbb-qb-report,
.tbb-qb-results-cards > .tbb-qb-disclaimer {
	grid-column: 1 / -1;
}

.tbb-qb-results-cards .tbb-qb-result-card {
	text-align: center;
	display: flex;
	flex-direction: column;
}

.tbb-qb-result-stack {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 100%;
	flex: 1 1 auto;
}

.tbb-qb-result-stack .tbb-qb-result-image {
	width: 100px;
	height: 100px;
	object-fit: contain;
	border-radius: 8px;
	margin-bottom: 14px;
}

.tbb-qb-result-stack h3 {
	font-weight: 800;
	font-size: 1.1rem;
	color: var( --tbb-qb-dark );
	margin: 0 0 6px;
}

.tbb-qb-result-stack.tbb-qb-result-stack p {
	margin: 0;
	color: #5f5f5f !important;
	font-size: 0.9rem;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	overflow: hidden;
}

.tbb-qb-result-cta-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
	width: 100%;
	/* Pins the button(s) to the bottom of the card even when a neighbouring
	   card's description is shorter and the row has stretched this one taller. */
	margin-top: auto;
	padding-top: 14px;
}

/* Repeated: a bare single class like ".tbb-qb-disclaimer" (specificity
   0,1,0) is LOWER than a theme's own paragraph rule scoped to its
   content wrapper (e.g. ".post-content p", specificity 0,1,1) even with
   !important on every property here - which is what left this looking
   like regular body text instead of small, muted disclaimer copy. */
.tbb-qb-disclaimer.tbb-qb-disclaimer {
	font-size: 0.78rem !important;
	line-height: 1.5 !important;
	color: #9a9a9a !important;
	text-align: center !important;
	max-width: 640px;
	margin: 20px auto 0 !important;
	/* Honour the line breaks typed into the Setup / Settings text boxes -
	   without this the browser collapses them all into one run of text. */
	white-space: pre-line !important;
}

/* The affiliate disclosure sits just below the disclaimer as its own
   paragraph, so it needs a smaller gap than the disclaimer has above it.
   A third class so it outranks the repeated-class rule above regardless of
   source order. */
.tbb-qb-disclaimer.tbb-qb-disclaimer.tbb-qb-affiliate {
	margin-top: 12px !important;
}

/* ---- Welcome screen (optional, shown before question 1) ----
   Same theme-collision hardening as the other text blocks: repeated class +
   !important on whatever a theme's own h2 / p rules would otherwise win. */
.tbb-qb-card.tbb-qb-welcome {
	padding: 48px 32px 40px;
}

.tbb-qb-welcome .tbb-qb-eyebrow {
	margin-bottom: 14px;
}

.tbb-qb-welcome-heading.tbb-qb-welcome-heading {
	font-size: 2rem !important;
	font-weight: 800 !important;
	line-height: 1.2 !important;
	color: var( --tbb-qb-dark ) !important;
	text-align: center !important;
	margin: 0 0 22px !important;
}

@media ( max-width: 480px ) {
	.tbb-qb-welcome-heading.tbb-qb-welcome-heading {
		font-size: 1.6rem !important;
	}
}

.tbb-qb-welcome-text.tbb-qb-welcome-text {
	font-size: 16px !important;
	line-height: 1.6 !important;
	color: #444444 !important;
	text-align: center !important;
	margin: 0 0 24px !important;
	/* Honour line breaks typed into the builder's text box. */
	white-space: pre-line !important;
}

.tbb-qb-welcome-start.tbb-qb-welcome-start {
	min-width: min( 260px, 100% );
	padding: 16px 44px;
	font-size: 1.1rem;
}

.tbb-qb-welcome-note.tbb-qb-welcome-note {
	font-size: 0.95rem !important;
	font-style: italic !important;
	color: #6b6b6b !important;
	text-align: center !important;
	margin: 18px 0 0 !important;
}

/* ---- Results intro (label / heading / text above the first result) ----
   Same theme-collision hardening as the other results text: the class is
   repeated and the at-risk properties are !important, because a theme's own
   h3 / p rules scoped to its content wrapper would otherwise win. */
.tbb-qb-intro.tbb-qb-intro {
	text-align: center;
	max-width: 640px;
	margin: 0 auto 8px;
	/* In the Cards layout the results are a grid - span every column
	   rather than being squeezed into the first cell. */
	grid-column: 1 / -1;
}

.tbb-qb-intro-label.tbb-qb-intro-label {
	font-size: 0.9rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var( --tbb-qb-primary ) !important;
	margin: 0 0 6px;
}

.tbb-qb-intro-heading.tbb-qb-intro-heading {
	font-size: 1.35rem !important;
	font-weight: 800 !important;
	line-height: 1.3 !important;
	color: var( --tbb-qb-dark ) !important;
	margin: 0 0 8px !important;
}

.tbb-qb-intro-text.tbb-qb-intro-text {
	font-size: 16px !important;
	line-height: 1.6 !important;
	color: #444444 !important;
	text-align: center !important;
	margin: 0 !important;
	/* Honour line breaks typed into the builder's text box. */
	white-space: pre-line !important;
}

.tbb-qb-retake {
	text-align: center;
	margin: 4px auto 0;
}

.tbb-qb-report.tbb-qb-report {
	text-align: center;
	margin: 6px 0 0;
}

/* Repeated class + !important, same as the CTA buttons: it's a real <a>, and
   a theme's own link color/hover rule scoped to its content wrapper (e.g.
   ".post-content a:hover") would otherwise win on specificity alone. */
.tbb-qb-report-link.tbb-qb-report-link {
	color: #757575 !important;
	font-size: 0.85rem !important;
	border-bottom: none !important;
	font-weight: normal;
}

.tbb-qb-report-link.tbb-qb-report-link:hover {
	color: var( --tbb-qb-dark ) !important;
}
