/* ==========================================================================
   Quranic Quiz — dark navy + gold theme
   ========================================================================== */

/* Declared on :root (not just #qq-quiz-root) so that the share/confirm modals —
   which are appended directly to <body> so they can cover the whole viewport —
   still resolve these colors. A var() that can't resolve falls back to nothing,
   which is what made those modals unreadable. */
:root {
	--qq-navy-950: #060a1a;
	--qq-navy-900: #0a1128;
	--qq-navy-800: #0f1a3d;
	--qq-navy-700: #16234f;
	--qq-navy-600: #1e2f66;
	--qq-gold-500: #d4af37;
	--qq-gold-400: #e8c96b;
	--qq-gold-300: #f3dd9a;
	--qq-gold-glow: rgba(212, 175, 55, 0.35);
	--qq-green: #2fbf71;
	--qq-red: #e6534d;
	--qq-amber: #f2b134;
	--qq-text: #f5f3ec;
	--qq-text-dim: #b9c2dd;
	--qq-radius: 18px;
	--qq-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
#qq-quiz-root {
	all: initial;
	font-family: var(--qq-font);
	display: block;
	max-width: 820px;
	margin: 32px auto;
	color: var(--qq-text);
	box-sizing: border-box;
	position: relative;
}
#qq-quiz-root, #qq-quiz-root * { box-sizing: border-box; }
#qq-quiz-root button { font-family: var(--qq-font); }
/* Safety net: a few headings (sign-in / home screen) render with no class of
   their own, so without this they inherit the WordPress theme's own heading
   color instead of ours — invisible against our dark card whenever the
   theme's own light/bright appearance uses a dark heading color. The ID
   selector here reliably wins over the theme's plain "h2 { color }" rule.
   .qq-brand h1's own gradient-text rule is a class selector on the SAME
   element and stays a separate case (h1 intentionally excluded below). */
#qq-quiz-root h2,
#qq-quiz-root h3,
#qq-quiz-root h4 {
	color: var(--qq-text);
}

.qq-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 60px 20px;
	color: var(--qq-text-dim);
	background: linear-gradient(160deg, var(--qq-navy-900), var(--qq-navy-800));
	border-radius: var(--qq-radius);
}
.qq-loading-spinner {
	width: 36px; height: 36px;
	border: 3px solid rgba(212,175,55,0.25);
	border-top-color: var(--qq-gold-500);
	border-radius: 50%;
	animation: qq-spin 0.9s linear infinite;
	margin-bottom: 14px;
}
@keyframes qq-spin { to { transform: rotate(360deg); } }

.qq-card {
	background: linear-gradient(160deg, var(--qq-navy-900) 0%, var(--qq-navy-800) 100%);
	border: 1px solid rgba(212, 175, 55, 0.22);
	border-radius: var(--qq-radius);
	box-shadow: 0 20px 50px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.04);
	padding: 36px 32px;
	position: relative;
	overflow: hidden;
	animation: qq-fade-up 0.45s ease both;
}
.qq-card::before {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background:
		radial-gradient(circle at 12% 0%, var(--qq-gold-glow), transparent 40%),
		radial-gradient(circle at 100% 100%, rgba(47,191,113,0.12), transparent 45%);
	opacity: 0.7;
}
@keyframes qq-fade-up {
	from { opacity: 0; transform: translateY(14px); }
	to { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------------------------- */
/* Header / branding                                                     */
/* -------------------------------------------------------------------- */
.qq-brand {
	text-align: center;
	margin-bottom: 22px;
	position: relative;
	z-index: 1;
}
.qq-brand .qq-bismillah {
	font-size: 13px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--qq-gold-400);
	margin-bottom: 6px;
}
.qq-brand h1 {
	font-size: 28px;
	margin: 0 0 6px;
	font-weight: 800;
	background: linear-gradient(90deg, var(--qq-gold-300), var(--qq-gold-500));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	letter-spacing: 0.01em;
}
.qq-brand p { margin: 0; color: var(--qq-text-dim); font-size: 15px; }

/* -------------------------------------------------------------------- */
/* Sign-in screen                                                        */
/* -------------------------------------------------------------------- */
.qq-signin { text-align: center; position: relative; z-index: 1; }
.qq-signin-icon {
	width: 64px; height: 64px; margin: 0 auto 18px;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(212,175,55,0.25), transparent 70%);
	display: flex; align-items: center; justify-content: center;
	font-size: 30px;
}
.qq-signin-note { font-size: 13px; color: var(--qq-text-dim); margin-top: 14px; }
.qq-name-form { max-width: 320px; margin: 26px auto 0; display: flex; flex-direction: column; gap: 12px; }
.qq-guest-input {
	width: 100%; box-sizing: border-box; padding: 13px 16px; border-radius: 12px;
	background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.15);
	color: var(--qq-text); font-size: 15px; font-family: inherit; text-align: center;
}
.qq-guest-input:focus { outline: none; border-color: var(--qq-gold-500); }
.qq-guest-input::placeholder { color: var(--qq-text-dim); }

/* -------------------------------------------------------------------- */
/* Difficulty selection                                                  */
/* -------------------------------------------------------------------- */
.qq-welcome-user {
	display: flex; align-items: center; gap: 12px;
	margin-bottom: 24px; position: relative; z-index: 1;
}
.qq-avatar {
	width: 46px; height: 46px; border-radius: 50%;
	border: 2px solid var(--qq-gold-500);
	object-fit: cover; background: var(--qq-navy-700);
}
.qq-avatar-fallback {
	width: 46px; height: 46px; border-radius: 50%;
	border: 2px solid var(--qq-gold-500);
	background: var(--qq-navy-700);
	display: flex; align-items: center; justify-content: center;
	font-weight: 700; color: var(--qq-gold-400);
}
.qq-welcome-user .qq-who { flex: 1; }
.qq-welcome-user .qq-who strong { display: block; font-size: 16px; }
.qq-welcome-user .qq-who span { font-size: 13px; color: var(--qq-text-dim); }
.qq-signout-link {
	background: none; border: none; color: var(--qq-text-dim);
	font-size: 13px; cursor: pointer; text-decoration: underline;
}
.qq-signout-link:hover { color: var(--qq-gold-400); }

.qq-stats-row {
	display: flex; gap: 10px; margin-bottom: 24px; position: relative; z-index: 1;
	flex-wrap: wrap;
}
.qq-stat-chip {
	flex: 1; min-width: 110px;
	background: rgba(255,255,255,0.04);
	border: 1px solid rgba(255,255,255,0.08);
	border-radius: 12px; padding: 10px 14px; text-align: center;
}
.qq-stat-chip .num { font-size: 20px; font-weight: 800; color: var(--qq-gold-400); display: block; }
.qq-stat-chip .lbl { font-size: 11px; color: var(--qq-text-dim); text-transform: uppercase; letter-spacing: 0.05em; }

.qq-diff-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
	position: relative; z-index: 1;
}
@media (max-width: 520px) { .qq-diff-grid { grid-template-columns: 1fr; } }

.qq-diff-card {
	border-radius: 14px;
	padding: 20px 18px;
	text-align: left;
	cursor: pointer;
	border: 1px solid rgba(255,255,255,0.1);
	background: rgba(255,255,255,0.03);
	transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
	display: flex; flex-direction: column; gap: 6px;
	color: var(--qq-text);
}
.qq-diff-card:hover, .qq-diff-card:focus-visible {
	transform: translateY(-3px);
	box-shadow: 0 14px 30px rgba(0,0,0,0.35);
	border-color: var(--qq-gold-500);
	outline: none;
}
.qq-diff-card .qq-diff-icon { font-size: 26px; }
.qq-diff-card .qq-diff-name { font-size: 17px; font-weight: 700; }
.qq-diff-card .qq-diff-desc { font-size: 12.5px; color: var(--qq-text-dim); }
.qq-diff-card.easy   { border-left: 4px solid var(--qq-green); }
.qq-diff-card.medium { border-left: 4px solid var(--qq-amber); }
.qq-diff-card.hard   { border-left: 4px solid var(--qq-red); }
.qq-diff-card.mixed  { border-left: 4px solid var(--qq-gold-500); }

.qq-history-link {
	display: block; text-align: center; margin-top: 20px;
	color: var(--qq-gold-400); text-decoration: none; font-size: 14px;
	cursor: pointer; position: relative; z-index: 1;
}
.qq-history-link:hover { text-decoration: underline; }

/* -------------------------------------------------------------------- */
/* Quiz screen                                                           */
/* -------------------------------------------------------------------- */
.qq-quiz-header {
	display: flex; align-items: center; justify-content: space-between;
	margin-bottom: 18px; position: relative; z-index: 1; gap: 12px; flex-wrap: wrap;
}
.qq-timer {
	font-variant-numeric: tabular-nums;
	font-size: 22px; font-weight: 800;
	background: rgba(255,255,255,0.05);
	border: 1px solid rgba(255,255,255,0.1);
	padding: 8px 16px; border-radius: 12px;
	display: flex; align-items: center; gap: 8px;
	color: var(--qq-gold-300);
}
.qq-timer.qq-timer-low {
	color: #fff; background: rgba(230,83,77,0.25); border-color: var(--qq-red);
	animation: qq-pulse 1s ease-in-out infinite;
}
@keyframes qq-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(230,83,77,0.5);} 50% { box-shadow: 0 0 0 8px rgba(230,83,77,0);} }

.qq-diff-badge {
	font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
	padding: 6px 12px; border-radius: 999px; font-weight: 700;
	background: rgba(212,175,55,0.15); color: var(--qq-gold-400);
	border: 1px solid rgba(212,175,55,0.3);
}

.qq-progress-wrap { position: relative; z-index: 1; margin-bottom: 14px; }
.qq-progress-label {
	display: flex; justify-content: space-between; font-size: 13px;
	color: var(--qq-text-dim); margin-bottom: 6px;
}
.qq-progress-bar {
	height: 10px; border-radius: 999px; background: rgba(255,255,255,0.08);
	overflow: hidden;
}
.qq-progress-fill {
	height: 100%; border-radius: 999px;
	background: linear-gradient(90deg, var(--qq-gold-500), var(--qq-gold-300));
	transition: width 0.35s ease;
}

.qq-nav-dots {
	display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 22px;
	position: relative; z-index: 1;
}
.qq-nav-dot {
	width: 30px; height: 30px; border-radius: 8px;
	display: flex; align-items: center; justify-content: center;
	font-size: 12px; font-weight: 700; cursor: pointer;
	background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12);
	color: var(--qq-text-dim);
	transition: all 0.15s ease;
}
.qq-nav-dot:hover { border-color: var(--qq-gold-500); }
.qq-nav-dot.answered { background: rgba(47,191,113,0.18); border-color: var(--qq-green); color: #bdf3d3; }
.qq-nav-dot.current { border-color: var(--qq-gold-500); box-shadow: 0 0 0 2px var(--qq-gold-glow); color: var(--qq-gold-300); }

.qq-question-card { position: relative; z-index: 1; }
.qq-question-text {
	font-size: 19px; line-height: 1.5; font-weight: 600; margin-bottom: 22px;
}
.qq-options { display: flex; flex-direction: column; gap: 12px; }
.qq-option {
	display: flex; align-items: center; gap: 12px;
	padding: 14px 16px; border-radius: 12px; cursor: pointer;
	background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.1);
	text-align: left; color: var(--qq-text); font-size: 15px;
	transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.qq-option:hover { border-color: rgba(212,175,55,0.5); transform: translateX(2px); }
.qq-option .qq-option-key {
	width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	font-weight: 800; font-size: 13px;
	background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
}
.qq-option.selected {
	background: rgba(212,175,55,0.14); border-color: var(--qq-gold-500);
}
.qq-option.selected .qq-option-key { background: var(--qq-gold-500); color: var(--qq-navy-900); border-color: var(--qq-gold-500); }

.qq-option.qq-correct { border-color: var(--qq-green); background: rgba(47,191,113,0.14); }
.qq-option.qq-correct .qq-option-key { background: var(--qq-green); color: #06210f; border-color: var(--qq-green); }
.qq-option.qq-incorrect { border-color: var(--qq-red); background: rgba(230,83,77,0.14); }
.qq-option.qq-incorrect .qq-option-key { background: var(--qq-red); color: #2a0806; border-color: var(--qq-red); }

.qq-quiz-actions {
	display: flex; justify-content: space-between; margin-top: 26px; gap: 10px;
	position: relative; z-index: 1;
}

/* -------------------------------------------------------------------- */
/* Buttons                                                               */
/* -------------------------------------------------------------------- */
.qq-btn {
	appearance: none; border: none; cursor: pointer;
	padding: 12px 22px; border-radius: 12px; font-size: 15px; font-weight: 700;
	transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}
.qq-btn:active { transform: scale(0.97); }
.qq-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.qq-btn-primary {
	background: linear-gradient(90deg, var(--qq-gold-500), var(--qq-gold-400));
	color: var(--qq-navy-950);
	box-shadow: 0 10px 24px rgba(212,175,55,0.28);
}
.qq-btn-primary:hover:not(:disabled) { box-shadow: 0 14px 30px rgba(212,175,55,0.4); }
.qq-btn-secondary {
	background: rgba(255,255,255,0.06); color: var(--qq-text);
	border: 1px solid rgba(255,255,255,0.15);
}
.qq-btn-secondary:hover:not(:disabled) { border-color: var(--qq-gold-500); }
.qq-btn-block { width: 100%; }
.qq-btn-lg { padding: 14px 26px; font-size: 16px; }

/* -------------------------------------------------------------------- */
/* Result screen                                                         */
/* -------------------------------------------------------------------- */
.qq-result-top { text-align: center; position: relative; z-index: 1; }
.qq-score-ring {
	width: 168px; height: 168px; margin: 6px auto 18px; position: relative;
}
.qq-score-ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.qq-score-ring circle { fill: none; stroke-width: 10; }
.qq-score-ring .qq-ring-bg { stroke: rgba(255,255,255,0.08); }
.qq-score-ring .qq-ring-fg {
	stroke: url(#qq-gold-gradient);
	stroke-linecap: round;
	transition: stroke-dashoffset 1s cubic-bezier(.22,1,.36,1);
}
.qq-score-ring .qq-ring-text {
	position: absolute; inset: 0; display: flex; flex-direction: column;
	align-items: center; justify-content: center;
}
.qq-score-ring .qq-ring-text .qq-score-num { font-size: 34px; font-weight: 800; color: var(--qq-gold-300); }
.qq-score-ring .qq-ring-text .qq-score-total { font-size: 13px; color: var(--qq-text-dim); }

.qq-result-message { font-size: 18px; font-weight: 700; margin: 4px 0 4px; }
.qq-result-sub { color: var(--qq-text-dim); font-size: 14px; margin-bottom: 22px; }

.qq-result-stats {
	display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
	margin-bottom: 26px; position: relative; z-index: 1;
}
@media (max-width: 520px) { .qq-result-stats { grid-template-columns: repeat(2, 1fr); } }
.qq-result-stats .qq-stat-chip .num.green { color: var(--qq-green); }
.qq-result-stats .qq-stat-chip .num.red { color: var(--qq-red); }
.qq-result-stats .qq-stat-chip .num.amber { color: var(--qq-amber); }

.qq-result-actions {
	display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
	margin-bottom: 8px; position: relative; z-index: 1;
}

.qq-review-list { margin-top: 22px; position: relative; z-index: 1; display: none; }
.qq-review-list.open { display: block; }
.qq-review-toolbar {
	display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
	margin-bottom: 18px; padding-bottom: 18px;
	border-bottom: 1px solid rgba(255,255,255,0.1);
}
.qq-review-item {
	border: 1px solid rgba(255,255,255,0.1); border-radius: 12px;
	padding: 16px; margin-bottom: 12px; background: rgba(255,255,255,0.02);
}
.qq-review-item .qq-review-q { font-weight: 600; margin-bottom: 10px; }
.qq-review-item .qq-review-tag {
	display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px;
	border-radius: 999px; margin-bottom: 8px; text-transform: uppercase;
}
.qq-review-item .qq-review-tag.correct { background: rgba(47,191,113,0.2); color: #7be3a6; }
.qq-review-item .qq-review-tag.incorrect { background: rgba(230,83,77,0.2); color: #f3908c; }
.qq-review-item .qq-review-tag.unanswered { background: rgba(255,255,255,0.1); color: var(--qq-text-dim); }
.qq-review-item .qq-review-ref { font-size: 12px; color: var(--qq-gold-400); margin-top: 8px; }
.qq-review-item .qq-review-explain { font-size: 13px; color: var(--qq-text-dim); margin-top: 6px; }

/* -------------------------------------------------------------------- */
/* History screen                                                        */
/* -------------------------------------------------------------------- */
.qq-history-item {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	border: 1px solid rgba(255,255,255,0.1); border-radius: 12px;
	padding: 14px 16px; margin-bottom: 10px; cursor: pointer;
	background: rgba(255,255,255,0.02); transition: border-color .15s ease;
}
.qq-history-item:hover { border-color: var(--qq-gold-500); }
.qq-history-item .qq-h-left { display: flex; flex-direction: column; gap: 3px; }
.qq-history-item .qq-h-date { font-size: 12px; color: var(--qq-text-dim); }
.qq-history-item .qq-h-score { font-size: 18px; font-weight: 800; color: var(--qq-gold-300); }
.qq-history-empty { text-align: center; color: var(--qq-text-dim); padding: 30px 0; }

/* -------------------------------------------------------------------- */
/* Misc                                                                  */
/* -------------------------------------------------------------------- */
.qq-error-banner {
	background: rgba(230,83,77,0.15); border: 1px solid var(--qq-red);
	color: #ffd9d7; padding: 12px 16px; border-radius: 10px; font-size: 14px;
	margin-bottom: 16px; position: relative; z-index: 1;
}
.qq-toast {
	position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
	background: var(--qq-navy-800); border: 1px solid var(--qq-gold-500);
	color: var(--qq-text); padding: 12px 20px; border-radius: 12px;
	box-shadow: 0 10px 30px rgba(0,0,0,0.4); z-index: 9999;
	font-size: 14px; opacity: 0; transition: opacity 0.25s ease;
}
.qq-toast.show { opacity: 1; }

.qq-modal-backdrop {
	position: fixed; inset: 0; background: rgba(6,10,26,0.72);
	display: flex; align-items: center; justify-content: center; z-index: 9998;
	padding: 20px; font-family: var(--qq-font); box-sizing: border-box;
}
.qq-modal-backdrop * { box-sizing: border-box; }
.qq-modal {
	background: var(--qq-navy-800); border: 1px solid var(--qq-gold-500);
	border-radius: 16px; padding: 26px; max-width: 380px; width: 100%;
	text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,0.5); color: var(--qq-text);
}
.qq-modal h3 { color: var(--qq-text); }
.qq-modal p { color: var(--qq-text-dim); margin: 10px 0 20px; font-size: 14px; }
.qq-modal .qq-modal-actions { display: flex; gap: 10px; justify-content: center; }

.qq-share-modal { max-width: 400px; }
.qq-share-modal h3 { font-size: 18px; }
.qq-share-modal .qq-btn-block + .qq-btn-block,
.qq-share-modal .qq-share-native-btn { margin-top: 10px; }
.qq-share-grid {
	display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px;
}
.qq-share-chip {
	display: flex; align-items: center; justify-content: center; gap: 6px;
	padding: 11px 10px; border-radius: 10px; font-size: 13px; font-weight: 600;
	background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);
	color: var(--qq-text); text-decoration: none; transition: border-color 0.15s ease, background 0.15s ease;
}
.qq-share-chip:hover { border-color: var(--qq-gold-500); background: rgba(212,175,55,0.1); }

.qq-back-link {
	background: none; border: none; color: var(--qq-text-dim); cursor: pointer;
	font-size: 13px; display: inline-flex; align-items: center; gap: 4px;
	margin-bottom: 14px; position: relative; z-index: 1;
}
.qq-back-link:hover { color: var(--qq-gold-400); }

.qq-confetti-piece {
	position: fixed; top: -20px; width: 8px; height: 14px; z-index: 9997;
	opacity: 0.9; pointer-events: none;
	animation: qq-fall linear forwards;
}
@keyframes qq-fall {
	to { transform: translateY(105vh) rotate(600deg); opacity: 0.2; }
}
