/* Quiz Master — Frontend Styles. All selectors are scoped under .qmquiz-* so nothing leaks into the site theme. */

.qmquiz-container {
	--qmquiz-primary: #6c4bf4;
	--qmquiz-primary-dark: #5636d6;
	--qmquiz-bg: #ffffff;
	--qmquiz-border: #e6e3f5;
	--qmquiz-text: #1f1a3c;
	--qmquiz-muted: #706c8a;
	--qmquiz-correct: #1e9e58;
	--qmquiz-correct-bg: #e8f8ee;
	--qmquiz-wrong: #d13b3b;
	--qmquiz-wrong-bg: #fdecec;
	--qmquiz-radius: 14px;

	/* IMPORTANT: explicit width:100% (not just max-width) so this box
	   always fills its parent instead of shrinking to fit whatever is
	   currently inside it — without this, the Start screen and the
	   Play screen can render at visibly different widths when the
	   parent is a flex/grid item (common in theme post-card layouts). */
	width: 100%;
	max-width: 720px;
	margin: 0 auto;
	background: var(--qmquiz-bg);
	border: 1px solid var(--qmquiz-border);
	border-radius: var(--qmquiz-radius);
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--qmquiz-text);
	box-sizing: border-box;
	box-shadow: 0 2px 18px rgba(31, 26, 60, 0.06);
}
.qmquiz-container * { box-sizing: border-box; }
.qmquiz-container > .qmquiz-play-screen,
.qmquiz-container > .qmquiz-result-screen,
.qmquiz-container > .qmquiz-review-screen { padding: 28px; }

/* ------------------------------------------------------------------ */
/* Full-bleed page wrapper — used by the dedicated hub/single-quiz
   pages ONLY (never for shortcode/block embeds inside normal posts).
   Breaks out of whatever narrow content column or blank-sidebar layout
   the active theme applies, so Quiz Master's own pages always render
   at a consistent, full width regardless of theme quirks.            */
/* ------------------------------------------------------------------ */
.qmquiz-page-wrapper {
	width: 100vw;
	position: relative;
	left: 50%;
	right: 50%;
	margin-left: -50vw;
	margin-right: -50vw;
	box-sizing: border-box;
	padding: 40px 20px 70px;
	background: #faf9ff;
}
.qmquiz-page-inner {
	max-width: 1180px;
	margin: 0 auto;
}
.qmquiz-page-inner-narrow { max-width: 780px; }

.qmquiz-breadcrumb { margin-bottom: 18px; }
.qmquiz-breadcrumb a {
	display: inline-flex; align-items: center; gap: 6px;
	color: var(--qmquiz-primary-dark, #5636d6);
	text-decoration: none;
	font-weight: 600;
	font-size: 14px;
	background: #fff;
	border: 1px solid #e6e3f5;
	padding: 7px 14px;
	border-radius: 999px;
}
.qmquiz-breadcrumb a:hover { border-color: #c9bdf9; text-decoration: none; }

/* Hub page hero */
.qmquiz-hero {
	text-align: center; margin-bottom: 28px;
	background: linear-gradient(135deg, #6c4bf4 0%, #a06bff 55%, #ff6ec7 120%);
	border-radius: 20px; padding: 46px 24px 38px; color: #fff;
	box-shadow: 0 14px 34px rgba(108,75,244,0.25);
}
.qmquiz-hero-eyebrow {
	display: inline-block; background: rgba(255,255,255,0.18); color: #fff;
	font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
	padding: 5px 14px; border-radius: 999px; margin-bottom: 14px;
}
.qmquiz-hero-title { font-size: 34px; font-weight: 800; margin: 0 0 10px; color: #fff; }
.qmquiz-hero-sub { color: rgba(255,255,255,0.9); font-size: 16px; margin: 0 0 22px; }
.qmquiz-hero-stats { display: flex; align-items: center; justify-content: center; gap: 20px; }
.qmquiz-hero-stat { display: flex; flex-direction: column; align-items: center; }
.qmquiz-hero-stat strong { font-size: 24px; font-weight: 800; line-height: 1.1; }
.qmquiz-hero-stat span { font-size: 12px; opacity: .85; text-transform: uppercase; letter-spacing: .05em; }
.qmquiz-hero-stat-divider { width: 1px; height: 30px; background: rgba(255,255,255,0.35); }

/* Category filter pills */
.qmquiz-filter-pills {
	display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
	margin-bottom: 30px;
}
.qmquiz-pill {
	display: inline-flex; align-items: center; gap: 6px;
	background: #fff; border: 1.5px solid #e6e3f5; color: #4b4570;
	padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
	text-decoration: none; transition: all .15s ease;
}
.qmquiz-pill:hover { border-color: #6c4bf4; color: #5636d6; }
.qmquiz-pill-active { background: #6c4bf4; border-color: #6c4bf4; color: #fff; }
.qmquiz-pill-count { opacity: .75; font-weight: 700; font-size: 12px; }

/* Archive quiz card grid (default layout) */
.qmquiz-archive-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 18px;
}
.qmquiz-archive-card {
	display: flex; flex-direction: column;
	background: #fff; border: 1px solid #e6e3f5; border-radius: 14px;
	padding: 22px; text-decoration: none; color: inherit;
	box-shadow: 0 2px 14px rgba(31,26,60,0.05);
	transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.qmquiz-archive-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 10px 26px rgba(108,75,244,0.15);
	border-color: #c9bdf9;
}
.qmquiz-archive-card-icon {
	font-size: 22px; margin-bottom: 12px;
	width: 44px; height: 44px; border-radius: 12px;
	background: #f1eefc; display: flex; align-items: center; justify-content: center;
}
.qmquiz-archive-card-body { flex: 1; }
.qmquiz-archive-card-cat {
	display: inline-block; background: #f1eefc; color: #5636d6;
	font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
	padding: 3px 10px; border-radius: 999px; margin-bottom: 8px;
}
.qmquiz-archive-card-title { font-size: 18px; font-weight: 700; margin: 0 0 6px; line-height: 1.35; }
.qmquiz-archive-card-desc { font-size: 14px; color: #706c8a; margin: 0 0 14px; line-height: 1.55; }
.qmquiz-archive-card-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: #8a86a3; margin-bottom: 14px; }
.qmquiz-archive-card-cta {
	display: inline-flex; align-items: center; gap: 6px;
	font-weight: 700; color: #6c4bf4; font-size: 14px; margin-top: auto;
}
.qmquiz-archive-card:hover .qmquiz-archive-card-cta { color: #5636d6; }

.qmquiz-empty-state {
	text-align: center; padding: 50px 20px; color: #706c8a;
	background: #fff; border: 1px dashed #d9d2f7; border-radius: 14px;
}

/* ------------------------------------------------------------------ */
/* Start screen                                                       */
/* ------------------------------------------------------------------ */
.qmquiz-start-banner {
	background: linear-gradient(135deg, var(--qmquiz-primary), #9b7bff);
	padding: 30px 28px 44px;
	display: flex; justify-content: center;
}
.qmquiz-start-icon {
	width: 64px; height: 64px; border-radius: 18px;
	background: rgba(255,255,255,0.2);
	display: flex; align-items: center; justify-content: center;
	font-size: 30px;
}
.qmquiz-start-body {
	background: #fff;
	border-radius: 18px;
	padding: 22px 26px 26px;
	margin: -26px 16px 0;
	position: relative;
	box-shadow: 0 8px 24px rgba(31,26,60,0.08);
}
.qmquiz-start-cat {
	display: inline-block; background: #f5f3ff; color: var(--qmquiz-primary-dark);
	font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
	padding: 4px 12px; border-radius: 999px; margin-bottom: 10px;
}
.qmquiz-title { font-size: 24px; font-weight: 700; margin: 0 0 8px; }
.qmquiz-description { color: var(--qmquiz-muted); margin: 8px 0 16px; line-height: 1.6; }

.qmquiz-meta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.qmquiz-meta-item {
	display: inline-flex; align-items: center; gap: 6px;
	background: #f5f3ff;
	border-radius: 999px;
	padding: 7px 14px;
	font-size: 13px;
	font-weight: 600;
	color: var(--qmquiz-primary-dark);
}
.qmquiz-meta-icon { font-size: 13px; }

.qmquiz-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	border: none;
	border-radius: 10px;
	padding: 12px 22px;
	min-width: 140px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	transition: transform .08s ease, box-shadow .15s ease, opacity .15s ease;
}
.qmquiz-btn-large { padding: 15px 30px; font-size: 16px; width: 100%; border-radius: 12px; box-shadow: 0 8px 20px rgba(108,75,244,0.28); }
.qmquiz-btn:focus-visible { outline: 3px solid #b7a7ff; outline-offset: 2px; }
.qmquiz-btn-primary { background: var(--qmquiz-primary); color: #fff; }
.qmquiz-btn-primary:hover { background: var(--qmquiz-primary-dark); }
.qmquiz-btn-secondary { background: #f1eefc; color: var(--qmquiz-primary-dark); }
.qmquiz-btn:disabled { opacity: .7; cursor: not-allowed; }

/* Loading spinner shown inside a button without collapsing its label */
.qmquiz-btn-loading { position: relative; color: transparent !important; }
.qmquiz-btn-loading::after {
	content: "";
	position: absolute;
	width: 18px; height: 18px;
	border-radius: 50%;
	border: 2.5px solid rgba(255,255,255,0.4);
	border-top-color: #fff;
	animation: qmquiz-spin .7s linear infinite;
}
@keyframes qmquiz-spin { to { transform: rotate(360deg); } }

/* Play screen */
.qmquiz-play-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.qmquiz-progress-text { font-weight: 600; color: var(--qmquiz-muted); font-size: 14px; }
.qmquiz-timer { font-weight: 700; font-variant-numeric: tabular-nums; padding: 6px 12px; border-radius: 8px; background: #fff4e5; color: #b5650a; }
.qmquiz-timer.qmquiz-timer-danger { background: var(--qmquiz-wrong-bg); color: var(--qmquiz-wrong); }

.qmquiz-progress-bar { height: 6px; background: #eee9ff; border-radius: 4px; overflow: hidden; margin-bottom: 20px; }
.qmquiz-progress-bar-fill { height: 100%; background: var(--qmquiz-primary); transition: width .25s ease; }

.qmquiz-question-text { font-size: 18px; font-weight: 600; margin: 4px 0 18px; line-height: 1.5; }

.qmquiz-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.qmquiz-option {
	display: flex;
	align-items: center;
	gap: 12px;
	border: 1.5px solid var(--qmquiz-border);
	border-radius: 10px;
	padding: 13px 16px;
	cursor: pointer;
	background: #fff;
	text-align: left;
	width: 100%;
	font-size: 15px;
	color: var(--qmquiz-text);
}
.qmquiz-option:hover { border-color: var(--qmquiz-primary); }
.qmquiz-option:focus-visible { outline: 3px solid #b7a7ff; outline-offset: 1px; }
.qmquiz-option.qmquiz-selected { border-color: var(--qmquiz-primary); background: #f5f3ff; }
.qmquiz-option-letter {
	flex: 0 0 auto;
	width: 28px; height: 28px;
	border-radius: 50%;
	background: #f1eefc;
	color: var(--qmquiz-primary-dark);
	display: flex; align-items: center; justify-content: center;
	font-weight: 700; font-size: 13px;
}
.qmquiz-option.qmquiz-selected .qmquiz-option-letter { background: var(--qmquiz-primary); color: #fff; }

.qmquiz-play-footer { display: flex; justify-content: space-between; gap: 10px; }

/* Result screen */
.qmquiz-result-screen { text-align: center; }
.qmquiz-result-badge {
	width: 96px; height: 96px; border-radius: 50%;
	background: var(--qmquiz-correct-bg); color: var(--qmquiz-correct);
	display: flex; align-items: center; justify-content: center;
	font-size: 26px; font-weight: 800; margin: 0 auto 14px;
}
.qmquiz-result-heading { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.qmquiz-result-sub { color: var(--qmquiz-muted); margin-bottom: 22px; }
.qmquiz-result-stats {
	display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
	margin-bottom: 22px; text-align: left;
}
.qmquiz-stat { background: #faf9ff; border: 1px solid var(--qmquiz-border); border-radius: 10px; padding: 12px; }
.qmquiz-stat-label { display: block; font-size: 12px; color: var(--qmquiz-muted); margin-bottom: 4px; }
.qmquiz-stat-value { display: block; font-size: 18px; font-weight: 700; }
.qmquiz-stat-correct .qmquiz-stat-value { color: var(--qmquiz-correct); }
.qmquiz-stat-wrong .qmquiz-stat-value { color: var(--qmquiz-wrong); }

.qmquiz-result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Detailed answer review */
.qmquiz-review-item {
	border: 1px solid var(--qmquiz-border);
	border-radius: 12px;
	padding: 16px;
	margin-bottom: 14px;
	text-align: left;
}
.qmquiz-review-question { font-weight: 600; margin-bottom: 12px; }
.qmquiz-review-status {
	display: inline-block; font-size: 12px; font-weight: 700;
	padding: 2px 10px; border-radius: 999px; margin-left: 8px; vertical-align: middle;
}
.qmquiz-review-status-correct { background: var(--qmquiz-correct-bg); color: var(--qmquiz-correct); }
.qmquiz-review-status-wrong { background: var(--qmquiz-wrong-bg); color: var(--qmquiz-wrong); }
.qmquiz-review-status-unanswered { background: #f1f1f1; color: var(--qmquiz-muted); }

.qmquiz-review-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.qmquiz-review-option {
	display: flex; align-items: center; gap: 10px;
	border: 1.5px solid var(--qmquiz-border);
	border-radius: 8px; padding: 10px 12px; font-size: 14px;
}
.qmquiz-review-option-icon { flex: 0 0 auto; font-weight: 700; }
.qmquiz-review-option.qmquiz-state-correct { border-color: var(--qmquiz-correct); background: var(--qmquiz-correct-bg); color: #12693a; }
.qmquiz-review-option.qmquiz-state-wrong-selected { border-color: var(--qmquiz-wrong); background: var(--qmquiz-wrong-bg); color: #8f2727; }
.qmquiz-review-option-tag { margin-left: auto; font-size: 11px; font-weight: 700; text-transform: uppercase; opacity: .85; }

.qmquiz-review-explanation { font-size: 14px; color: var(--qmquiz-muted); background: #faf9ff; border-radius: 8px; padding: 10px 12px; }

/* Related quizzes */
.qmquiz-related { margin-top: 26px; text-align: left; }
.qmquiz-related h3 { font-size: 16px; margin-bottom: 12px; }
.qmquiz-related-item { border: 1px solid var(--qmquiz-border); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.qmquiz-related-item-title { font-weight: 600; }
.qmquiz-related-item-desc { font-size: 13px; color: var(--qmquiz-muted); }

.qmquiz-notice { padding: 14px; border-radius: 10px; background: #fff4e5; color: #7a4a05; }
.qmquiz-error { padding: 14px; border-radius: 10px; background: var(--qmquiz-wrong-bg); color: var(--qmquiz-wrong); margin-bottom: 14px; }

/* Responsive */
@media (max-width: 900px) {
	.qmquiz-page-wrapper { padding: 26px 16px 50px; }
	.qmquiz-hero { padding: 34px 20px 28px; }
	.qmquiz-hero-title { font-size: 26px; }
	.qmquiz-archive-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
@media (max-width: 480px) {
	.qmquiz-container > .qmquiz-play-screen,
	.qmquiz-container > .qmquiz-result-screen,
	.qmquiz-container > .qmquiz-review-screen { padding: 18px; }
	.qmquiz-start-banner { padding: 22px 20px 36px; }
	.qmquiz-start-body { padding: 0 18px 22px; }
	.qmquiz-result-stats { grid-template-columns: repeat(2, 1fr); }
	.qmquiz-play-footer { flex-direction: column-reverse; }
	.qmquiz-play-footer .qmquiz-btn { width: 100%; }
	.qmquiz-archive-grid { grid-template-columns: 1fr; }
	.qmquiz-hero-title { font-size: 22px; }
	.qmquiz-hero-stats { gap: 14px; }
	.qmquiz-filter-pills { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
}

/* Accessibility: never rely on color alone (icons/text always present too) */
.qmquiz-visually-hidden {
	position: absolute !important;
	width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
	clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
