.bq-quiz-wrap {
	--bq-primary: #5e61f1;
	--bq-primary-dark: #4338ca;
	--bq-success: #10b981;
	--bq-danger: #ef4444;
	--bq-bg: #ffffff;
	--bq-surface: #f8fafc;
	--bq-border: #e2e8f0;
	--bq-text: #1e293b;
	--bq-text-muted: #64748b;
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--bq-text);
	max-width: 720px;
	margin: 0 auto;
}
.bq-quiz-wrap *, .bq-quiz-wrap *::before, .bq-quiz-wrap *::after { box-sizing: border-box; }
.bq-quiz-wrap[hidden] { display: none; }

.bq-empty { text-align: center; padding: 40px 20px; color: var(--bq-text-muted); }

/* Buttons */
.bq-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	padding: 12px 24px; border-radius: 12px; border: 1px solid var(--bq-border);
	background: var(--bq-surface); color: var(--bq-text); font-size: 15px; font-weight: 600;
	cursor: pointer; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease;
}
.bq-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.bq-btn:disabled { opacity: .5; cursor: not-allowed; }
.bq-btn-primary { background: var(--bq-primary); border-color: var(--bq-primary); color: #fff; }
.bq-btn-primary:hover:not(:disabled) { background: var(--bq-primary-dark); }

/* Landing (category-grouped) */
.bq-landing-wrap { max-width: 960px; }
.bq-landing-lb-cta { text-align: right; margin-bottom: 18px; }
.bq-cat-section { margin: 0 0 36px; }
.bq-cat-heading { font-size: 20px; font-weight: 800; margin: 0 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--bq-border); color: var(--bq-primary); }
.bq-cat-count { font-size: 13px; color: var(--bq-text-muted); font-weight: 600; }

/* Card grid (list shortcode) */
.bq-card-grid {
	display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px;
}
.bq-card {
	display: block; border: 1px solid var(--bq-border); border-radius: 16px; padding: 20px;
	background: var(--bq-bg); text-decoration: none; color: inherit;
	transition: transform .15s ease, box-shadow .15s ease; position: relative; overflow: hidden;
}
.bq-card::before {
	content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--bq-accent, var(--bq-primary));
}
.bq-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,.08); }
.bq-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.bq-card-icon { font-size: 28px; }
.bq-card-badge { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.bq-badge-live { background: #dcfce7; color: #166534; }
.bq-badge-upcoming { background: #fef3c7; color: #92400e; }
.bq-badge-archived { background: #f1f5f9; color: #475569; }
.bq-badge-draft { background: #fee2e2; color: #991b1b; }
.bq-card-title { font-size: 18px; font-weight: 700; margin: 0 0 6px; }
.bq-card-desc { font-size: 14px; color: var(--bq-text-muted); margin: 0 0 12px; line-height: 1.5; }
.bq-card-meta { display: flex; gap: 14px; font-size: 13px; color: var(--bq-text-muted); font-weight: 600; }

/* Intro screen */
.bq-screen-intro { text-align: center; padding: 8px 4px 24px; }
.bq-intro-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 12px; }
.bq-intro-icon { font-size: 44px; }
.bq-intro-badge { font-size: 12px; font-weight: 700; padding: 5px 14px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.bq-intro-title { font-size: 26px; font-weight: 800; margin: 4px 0 8px; }
.bq-intro-desc { color: var(--bq-text-muted); line-height: 1.6; max-width: 520px; margin: 0 auto 20px; }
.bq-intro-stats { display: flex; justify-content: center; gap: 28px; flex-wrap: wrap; margin: 20px 0; }
.bq-stat { display: flex; flex-direction: column; align-items: center; }
.bq-stat strong { font-size: 22px; font-weight: 800; }
.bq-stat span { font-size: 12px; color: var(--bq-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.bq-intro-jokers { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 16px 0 24px; }
.bq-joker-chip { font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--bq-surface); border: 1px solid var(--bq-border); cursor: help; }
.bq-intro-hint { color: var(--bq-text-muted); font-size: 14px; margin-top: 10px; }
.bq-intro-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Join screen */
.bq-screen-join { max-width: 380px; margin: 0 auto; text-align: center; padding: 20px 4px; }
.bq-screen-join h3 { font-size: 20px; margin-bottom: 18px; }
.bq-join-form { display: flex; flex-direction: column; gap: 14px; }
.bq-join-form label { text-align: left; font-size: 13px; font-weight: 600; color: var(--bq-text-muted); display: flex; flex-direction: column; gap: 6px; }
.bq-join-form input {
	padding: 12px 14px; border-radius: 10px; border: 1px solid var(--bq-border); font-size: 15px;
	color: var(--bq-text); background: var(--bq-bg);
}
.bq-join-form input:focus { outline: 2px solid var(--bq-primary); outline-offset: 1px; }
.bq-join-error { color: var(--bq-danger); font-size: 13px; font-weight: 600; }

/* Play screen */
.bq-play-top { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.bq-progress-wrap { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.bq-progress-meta { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 700; color: var(--bq-text-muted); }
.bq-question-counter { color: var(--bq-primary); }
.bq-question-counter .bq-qc-current { font-size: 16px; font-weight: 800; color: var(--bq-primary); }
.bq-question-counter .bq-qc-total { color: var(--bq-text-muted); }
.bq-score-live { font-weight: 700; }
.bq-score-live .bq-score-num { color: var(--bq-primary); font-size: 15px; font-weight: 800; }
.bq-progress { flex: 1; height: 8px; background: var(--bq-surface); border-radius: 999px; overflow: hidden; }
.bq-progress-bar { height: 100%; background: var(--bq-primary); border-radius: 999px; transition: width .3s ease; width: 0; }
.bq-timer { position: relative; width: 44px; height: 44px; flex-shrink: 0; }
.bq-timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.bq-timer-bg { fill: none; stroke: var(--bq-border); stroke-width: 3; }
.bq-timer-fg { fill: none; stroke: var(--bq-primary); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset .1s linear, stroke .2s ease; }
.bq-timer-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; }

.bq-jokers-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.bq-joker-btn {
	display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px;
	border: 1px solid var(--bq-border); background: var(--bq-surface); font-size: 13px; font-weight: 600;
	cursor: pointer; color: var(--bq-text);
}
.bq-joker-btn:hover:not(:disabled) { border-color: var(--bq-primary); }
.bq-joker-btn:disabled, .bq-joker-used { opacity: .4; cursor: not-allowed; }
.bq-joker-icon { font-size: 15px; }

.bq-question-card { background: var(--bq-surface); border-radius: 18px; padding: 24px; }
.bq-question-image { margin-bottom: 16px; border-radius: 12px; overflow: hidden; }
.bq-question-image img { width: 100%; display: block; }
.bq-question-text { font-size: 19px; font-weight: 700; line-height: 1.4; margin: 0 0 20px; }

.bq-options { display: flex; flex-direction: column; gap: 10px; }
.bq-option {
	text-align: left; padding: 14px 16px; border-radius: 12px; border: 2px solid var(--bq-border);
	background: var(--bq-bg); font-size: 15px; font-weight: 600; cursor: pointer; color: var(--bq-text);
	transition: border-color .15s ease, background .15s ease;
}
.bq-option:hover:not(:disabled) { border-color: var(--bq-primary); }
.bq-option:disabled { cursor: default; }
.bq-option-eliminated { opacity: .3; text-decoration: line-through; }
.bq-option-correct { border-color: var(--bq-success); background: #ecfdf5; color: #065f46; }
.bq-option-wrong { border-color: var(--bq-danger); background: #fef2f2; color: #991b1b; }

/* Audience joker — bar-behind-option + percentage badge (SGD-style) */
.bq-option { position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: center; gap: 10px; }
.bq-option-audience::before {
	content: ''; position: absolute; left: 0; top: 0; bottom: 0;
	width: 0;
	background: linear-gradient(90deg, rgba(99, 102, 241, .35) 0%, rgba(67, 56, 202, .18) 100%);
	transition: width .8s cubic-bezier(.4, 0, .2, 1);
	z-index: -1;
}
.bq-option-audience-show::before { width: var(--audience-pct, 0%); }
.bq-audience-badge {
	margin-left: auto; padding: 4px 11px;
	background: linear-gradient(135deg, var(--bq-primary), var(--bq-primary-dark)); color: #fff;
	border-radius: 100px; font-size: 12px; font-weight: 600;
	display: inline-flex; align-items: center; gap: 4px;
	animation: bq-audience-pop .4s cubic-bezier(.34, 1.56, .64, 1) .3s both;
	box-shadow: 0 2px 6px rgba(99, 102, 241, .3);
	flex-shrink: 0;
}
.bq-audience-badge strong { font-size: 13px; }
@keyframes bq-audience-pop {
	0% { transform: scale(0); opacity: 0; }
	60% { transform: scale(1.15); }
	100% { transform: scale(1); opacity: 1; }
}

.bq-explanation { margin-top: 16px; padding: 12px 14px; background: #eef2ff; border-radius: 10px; font-size: 14px; color: #3730a3; }

/* Result screen */
.bq-screen-result { text-align: center; padding: 20px 4px; position: relative; overflow: hidden; }
.bq-result-icon { font-size: 56px; }
.bq-result-title { font-size: 26px; font-weight: 800; margin: 8px 0 20px; }
.bq-result-stats { display: flex; justify-content: center; gap: 26px; flex-wrap: wrap; margin-bottom: 8px; }
.bq-result-practice-note { color: var(--bq-text-muted); font-size: 13px; margin: 10px 0; }
.bq-result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 22px 0; }
.bq-result-review { text-align: left; max-width: 480px; margin: 20px auto 0; padding: 0 0 0 8px; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.bq-result-review li { font-size: 14px; padding: 10px 12px; border-radius: 10px; background: var(--bq-surface); }
.bq-review-correct { border-left: 3px solid var(--bq-success); }
.bq-review-wrong { border-left: 3px solid var(--bq-danger); }
.bq-review-skip { border-left: 3px solid var(--bq-text-muted); }

.bq-confetti-piece {
	position: absolute; top: -10px; width: 8px; height: 14px; opacity: .9; pointer-events: none;
	animation: bq-fall 2s ease-in forwards;
}
@keyframes bq-fall {
	to { transform: translateY(420px) rotate(360deg); opacity: 0; }
}

/* Leaderboard */
.bq-leaderboard-wrap { padding: 4px; }
.bq-lb-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.bq-lb-header h2 { font-size: 22px; font-weight: 800; margin: 0; }
.bq-lb-tabs { display: flex; gap: 6px; }
.bq-lb-tabs a { padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--bq-text-muted); background: var(--bq-surface); }
.bq-lb-tabs a.active { background: var(--bq-primary); color: #fff; }
.bq-lb-back { font-size: 14px; font-weight: 600; text-decoration: none; color: var(--bq-primary); }

.bq-podium { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; align-items: end; margin-bottom: 24px; }
.bq-podium-item { background: var(--bq-surface); border-radius: 16px; padding: 20px 12px; text-align: center; }
.bq-podium-1 { order: 2; padding-top: 30px; background: linear-gradient(180deg, #fef9c3, var(--bq-surface)); }
.bq-podium-2 { order: 1; }
.bq-podium-3 { order: 3; }
.bq-podium-medal { font-size: 30px; }
.bq-podium-name { font-weight: 700; margin-top: 6px; }
.bq-podium-city { font-size: 12px; color: var(--bq-text-muted); }
.bq-podium-score { margin-top: 8px; font-weight: 800; color: var(--bq-primary); }

.bq-lb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bq-lb-list li { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-radius: 10px; background: var(--bq-surface); counter-increment: bq-rank; }
.bq-lb-list li::before { content: counter(bq-rank) "."; font-weight: 700; color: var(--bq-text-muted); margin-right: 10px; }
.bq-lb-list { counter-reset: bq-rank 3; }
.bq-lb-name em { font-style: normal; color: var(--bq-text-muted); font-size: 12px; margin-left: 6px; }
.bq-lb-score { font-weight: 800; color: var(--bq-primary); }

@media (max-width: 560px) {
	.bq-podium { grid-template-columns: 1fr 1fr 1fr; }
	.bq-intro-stats { gap: 18px; }
	.bq-result-stats { gap: 16px; }
}

@media (prefers-color-scheme: dark) {
	.bq-quiz-wrap {
		--bq-bg: #1e293b;
		--bq-surface: #0f172a;
		--bq-border: #334155;
		--bq-text: #e2e8f0;
		--bq-text-muted: #94a3b8;
	}
	.bq-option-correct { background: rgba(16,185,129,.15); color: #6ee7b7; }
	.bq-option-wrong { background: rgba(239,68,68,.15); color: #fca5a5; }
	.bq-explanation { background: rgba(99,102,241,.15); color: #c7d2fe; }
	.bq-podium-1 { background: linear-gradient(180deg, rgba(250,204,21,.15), var(--bq-surface)); }
}
