/* Quizpio frontend styles. Scoped to .quizpio-mount and descendants. */

/* Visually hidden but available to assistive tech (screen readers). */
.quizpio-mount .qp-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}

/* Visible focus ring for keyboard navigation. */
.quizpio-mount button:focus-visible,
.quizpio-mount a:focus-visible,
.quizpio-mount input:focus-visible {
	outline: 3px solid #fbbf24;
	outline-offset: 2px;
}

.quizpio-mount {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: #1f2937;
	max-width: 960px;
	margin: 24px auto;
}

/* When a sidebar is showing on the host view, allow more horizontal room. */
.quizpio-mount:has( .qp-host.has-sidebar ) {
	max-width: 1400px;
}

.quizpio-mount .qp-loading {
	text-align: center;
	padding: 40px;
	color: #6b7280;
}

.quizpio-mount .qp-error {
	background: #fef2f2;
	color: #b91c1c;
	padding: 10px 14px;
	border-radius: 6px;
	margin-bottom: 12px;
	border: 1px solid #fecaca;
}

/* Buttons */
.quizpio-mount .qp-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 18px;
	border: 0;
	border-radius: 8px;
	font-weight: 600;
	font-size: 15px;
	cursor: pointer;
	transition: transform 0.05s ease, opacity 0.15s ease;
}
.quizpio-mount .qp-btn:active { transform: scale( 0.97 ); }
.quizpio-mount .qp-btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.quizpio-mount .qp-btn-primary { background: #4f46e5; color: #fff; }
.quizpio-mount .qp-btn-primary:hover { background: #4338ca; }
.quizpio-mount .qp-btn-secondary { background: #ffffff; color: #1f2937; border: 1px solid #d1d5db; }
.quizpio-mount .qp-btn-secondary:hover { background: #f3f4f6; }
.quizpio-mount .qp-btn-danger  { background: #ef4444; color: #fff; }
.quizpio-mount .qp-btn-danger:hover  { background: #dc2626; }
.quizpio-mount .qp-link {
	background: none; border: 0; color: #4f46e5;
	cursor: pointer; padding: 4px; text-decoration: underline;
}

/* Join form */
.quizpio-mount .qp-join {
	max-width: 380px;
	margin: 0 auto;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 16px;
	padding: 28px;
	box-shadow: 0 4px 24px rgba( 0, 0, 0, 0.04 );
}
.quizpio-mount .qp-join h3 { margin: 0 0 16px; font-size: 22px; }
.quizpio-mount .qp-join input {
	width: 100%;
	box-sizing: border-box;
	padding: 12px 14px;
	border: 1px solid #d1d5db;
	border-radius: 10px;
	font-size: 16px;
	margin-bottom: 12px;
}
.quizpio-mount .qp-join input:focus {
	outline: 0;
	border-color: #4f46e5;
	box-shadow: 0 0 0 3px rgba( 79, 70, 229, 0.15 );
}
.quizpio-mount .qp-join .qp-btn { width: 100%; justify-content: center; }

/* Host launch screen */
.quizpio-mount .qp-host-launch {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 16px;
	padding: 24px;
	text-align: center;
}
.quizpio-mount .qp-host-launch h3 { margin: 0 0 8px; }

/* Host bar */
.quizpio-mount .qp-host { background: #fff; border: 1px solid #e5e7eb; border-radius: 16px; overflow: hidden; }
.quizpio-mount .qp-host-bar {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 12px 16px;
	background: #1f2937;
	color: #fff;
	flex-wrap: wrap;
}
.quizpio-mount .qp-host-bar .qp-pin b { font-size: 18px; letter-spacing: 1px; }
.quizpio-mount .qp-host-actions { margin-left: auto; display: flex; gap: 8px; }

/* Host stage: main content + optional sidebar leaderboard */
.quizpio-mount .qp-host-stage {
	display: block;
}
.quizpio-mount .qp-host-stage.has-sidebar {
	/* On wide viewports show the sidebar to the right of the main column. */
	display: grid;
	grid-template-columns: 1fr;
}
@media ( min-width: 1024px ) {
	.quizpio-mount .qp-host-stage.has-sidebar {
		grid-template-columns: minmax( 0, 1fr ) 320px;
	}
}
.quizpio-mount .qp-host-main {
	min-width: 0; /* let grid track shrink */
}
.quizpio-mount .qp-host-sidebar {
	display: none; /* hidden on narrow; revealed by media query */
	border-left: 1px solid #e5e7eb;
	padding: 24px 20px;
	background: #fafbfc;
	min-width: 0;
}
@media ( min-width: 1024px ) {
	.quizpio-mount .qp-host-stage.has-sidebar .qp-host-sidebar {
		display: block;
	}
}
.quizpio-mount .qp-sidebar-toggle {
	/* only meaningful on wider screens; hide on narrow */
	display: none;
}
@media ( min-width: 1024px ) {
	.quizpio-mount .qp-sidebar-toggle { display: inline-flex; }
}
.quizpio-mount .qp-sidebar-title {
	margin: 0 0 12px;
	font-size: 13px;
	color: #4b5563;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	font-weight: 700;
}
.quizpio-mount .qp-sidebar-list {
	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-variant-numeric: tabular-nums;
}
.quizpio-mount .qp-sidebar-row {
	display: grid;
	grid-template-columns: 28px 1fr auto;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	background: #fff;
	border: 1px solid #f3f4f6;
	border-radius: 8px;
	transition: transform 0.3s ease, background 0.3s ease;
}
.quizpio-mount .qp-sidebar-rank {
	font-weight: 700;
	color: #6b7280;
	font-size: 13px;
	text-align: center;
}
.quizpio-mount .qp-sidebar-name {
	font-weight: 600;
	color: #111827;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	min-width: 0;
}
.quizpio-mount .qp-sidebar-score {
	font-weight: 700;
	color: #4f46e5;
}
.quizpio-mount .qp-sidebar-row.qp-lb-1 { background: #fffbeb; border-color: #fcd34d; }
.quizpio-mount .qp-sidebar-row.qp-lb-1 .qp-sidebar-rank { color: #d97706; }
.quizpio-mount .qp-sidebar-row.qp-lb-2 { background: #f8fafc; border-color: #cbd5e1; }
.quizpio-mount .qp-sidebar-row.qp-lb-2 .qp-sidebar-rank { color: #475569; }
.quizpio-mount .qp-sidebar-row.qp-lb-3 { background: #fff7ed; border-color: #fdba74; }
.quizpio-mount .qp-sidebar-row.qp-lb-3 .qp-sidebar-rank { color: #b45309; }

/* Lobby */
.quizpio-mount .qp-lobby { padding: 32px; text-align: center; }
.quizpio-mount .qp-pin-display {
	display: inline-block;
	margin: 16px auto 24px;
	padding: 24px 48px;
	background: #f3f4f6;
	border-radius: 16px;
}
.quizpio-mount .qp-pin-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: #6b7280; }
.quizpio-mount .qp-pin-num   { font-size: 48px; font-weight: 700; letter-spacing: 4px; color: #1f2937; }
.quizpio-mount .qp-players   { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.quizpio-mount .qp-player-chip {
	background: #4f46e5;
	color: #fff;
	padding: 6px 12px;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 500;
}

/* Question (host + player share) */
.quizpio-mount .qp-q-text { margin: 0 0 16px; font-size: 26px; line-height: 1.3; }
.quizpio-mount .qp-q-meta {
	display: flex; justify-content: space-between; align-items: center;
	margin: 0 0 12px;
	color: #6b7280;
	font-size: 14px;
}
.quizpio-mount .qp-timer {
	background: #1f2937;
	color: #fff;
	padding: 4px 12px;
	border-radius: 999px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}
.quizpio-mount .qp-timer-small {
	font-size: 13px;
	padding: 3px 10px;
}
.quizpio-mount .qp-reveal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
}
.quizpio-mount .qp-paused-badge {
	background: #fef3c7;
	color: #92400e;
	padding: 4px 10px;
	border-radius: 999px;
	font-weight: 600;
	font-size: 12px;
}
.quizpio-mount .qp-paused-banner {
	background: #fef3c7;
	color: #92400e;
	padding: 10px 14px;
	border-radius: 8px;
	margin-bottom: 12px;
	text-align: center;
	font-weight: 600;
}
.quizpio-mount .qp-host.is-paused .qp-host-question,
.quizpio-mount .qp-host.is-paused .qp-host-reveal {
	opacity: 0.85;
}
.quizpio-mount .qp-lobby-help { margin-top: 12px; color: #6b7280; font-size: 13px; }
.quizpio-mount .qp-empty { color: #6b7280; font-size: 13px; padding: 8px 0; }
.quizpio-mount .qp-options {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}
.quizpio-mount .qp-option {
	display: flex; align-items: center; gap: 14px;
	padding: 18px 20px;
	border-radius: 12px;
	background: #ffffff;
	border: 2px solid #e5e7eb;
	color: #111827;
	font-size: 17px;
	font-weight: 600;
	min-height: 84px;
	text-align: left;
	transition: transform 0.15s ease, opacity 0.2s ease, border-color 0.15s ease, background 0.15s ease;
}
.quizpio-mount .qp-player-options .qp-option { cursor: pointer; }
.quizpio-mount .qp-player-options .qp-option:hover:not([disabled]) {
	transform: translateY( -2px );
	border-color: #4f46e5;
}
.quizpio-mount .qp-option.is-picked {
	background: #eef2ff;
	border-color: #4f46e5;
	color: #3730a3;
}
.quizpio-mount .qp-option.is-picked .qp-shape {
	background: #4f46e5;
	color: #fff;
}
.quizpio-mount .qp-option.is-faded { opacity: 0.5; }
.quizpio-mount .qp-shape {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 8px;
	background: #4f46e5;
	color: #fff;
	font-size: 16px;
	font-weight: 800;
	flex-shrink: 0;
	letter-spacing: 0;
	font-variant-numeric: tabular-nums;
	transition: background 0.15s ease, color 0.15s ease;
}
.quizpio-mount .qp-opt-text { flex: 1; word-break: break-word; }

/* Host question / reveal */
.quizpio-mount .qp-host-question, .quizpio-mount .qp-host-reveal, .quizpio-mount .qp-host-final { padding: 32px; }

/* === Final Results === */
.quizpio-mount .qp-final-title {
	margin: 0 0 24px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 28px;
	font-weight: 700;
	color: #111827;
	letter-spacing: -0.5px;
}

/* Summary strip */
.quizpio-mount .qp-final-summary {
	display: grid;
	grid-template-columns: repeat( 4, 1fr );
	gap: 12px;
	margin-bottom: 32px;
}
.quizpio-mount .qp-summary-tile {
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	padding: 16px;
	text-align: center;
}
.quizpio-mount .qp-summary-value {
	font-size: 28px;
	font-weight: 700;
	color: #111827;
	line-height: 1;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.quizpio-mount .qp-summary-label {
	margin-top: 6px;
	font-size: 12px;
	color: #6b7280;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	font-weight: 600;
}

/* Podium */
.quizpio-mount .qp-podium {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 12px;
	align-items: end;
	margin-bottom: 32px;
}
.quizpio-mount .qp-podium-block {
	border-radius: 12px;
	padding: 20px 12px 16px;
	text-align: center;
	color: #fff;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.quizpio-mount .qp-podium-empty { background: transparent; min-height: 80px; }
.quizpio-mount .qp-podium-1 {
	background: linear-gradient( 180deg, #fbbf24 0%, #f59e0b 100% );
	min-height: 160px;
	box-shadow: 0 4px 16px rgba( 245, 158, 11, 0.3 );
}
.quizpio-mount .qp-podium-2 {
	background: linear-gradient( 180deg, #cbd5e1 0%, #94a3b8 100% );
	min-height: 130px;
}
.quizpio-mount .qp-podium-3 {
	background: linear-gradient( 180deg, #d97706 0%, #b45309 100% );
	min-height: 110px;
}
.quizpio-mount .qp-podium-medal {
	font-size: 36px;
	margin-bottom: 6px;
	line-height: 1;
}
.quizpio-mount .qp-podium-name {
	font-size: 18px;
	font-weight: 700;
	margin-bottom: 4px;
	word-break: break-word;
}
.quizpio-mount .qp-podium-score {
	font-size: 14px;
	opacity: 0.9;
	font-variant-numeric: tabular-nums;
}

/* Standings (4th+) */
.quizpio-mount .qp-standings {
	background: #f9fafb;
	border-radius: 12px;
	padding: 16px 20px;
	margin-bottom: 24px;
}
.quizpio-mount .qp-standings h3 {
	margin: 0 0 8px;
	font-size: 14px;
	color: #4b5563;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.quizpio-mount .qp-standings ol { margin: 0; padding-left: 28px; }
.quizpio-mount .qp-standings li {
	display: flex;
	justify-content: space-between;
	padding: 6px 0;
	font-weight: 500;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Question recap */
.quizpio-mount .qp-recap {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	padding: 20px;
}
.quizpio-mount .qp-recap > h3 {
	margin: 0 0 16px;
	font-size: 14px;
	color: #4b5563;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.quizpio-mount .qp-recap-list {
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.quizpio-mount .qp-recap-row {
	padding: 12px 14px;
	border: 1px solid #f3f4f6;
	border-radius: 10px;
	background: #fafbfc;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.quizpio-mount .qp-recap-head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 6px;
}
.quizpio-mount .qp-recap-num {
	background: #4f46e5;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: 999px;
	flex-shrink: 0;
}
.quizpio-mount .qp-recap-q {
	flex: 1;
	font-weight: 600;
	color: #111827;
	min-width: 0;
	word-break: break-word;
}
.quizpio-mount .qp-recap-pct {
	font-weight: 700;
	color: #16a34a;
	font-variant-numeric: tabular-nums;
	flex-shrink: 0;
}
.quizpio-mount .qp-recap-answer {
	font-size: 14px;
	color: #065f46;
	margin-bottom: 6px;
}
.quizpio-mount .qp-recap-bar {
	height: 6px;
	background: #f3f4f6;
	border-radius: 3px;
	overflow: hidden;
	margin-bottom: 4px;
}
.quizpio-mount .qp-recap-bar-fill {
	height: 100%;
	background: linear-gradient( 90deg, #16a34a 0%, #22c55e 100% );
	border-radius: 3px;
	transition: width 0.4s ease;
}
.quizpio-mount .qp-recap-meta {
	font-size: 12px;
	color: #6b7280;
}

@media ( max-width: 600px ) {
	.quizpio-mount .qp-final-summary { grid-template-columns: repeat( 2, 1fr ); }
	.quizpio-mount .qp-podium { grid-template-columns: 1fr; }
	.quizpio-mount .qp-podium-1, .quizpio-mount .qp-podium-2, .quizpio-mount .qp-podium-3 { min-height: auto; }
}
.quizpio-mount .qp-bars { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.quizpio-mount .qp-bar-row {
	display: grid;
	grid-template-columns: 200px 1fr 60px;
	align-items: center;
	gap: 12px;
}
.quizpio-mount .qp-bar-row.is-correct .qp-bar-label { color: #16a34a; font-weight: 700; }
.quizpio-mount .qp-bar-label {
	display: flex;
	align-items: center;
	min-width: 0;
}
.quizpio-mount .qp-bar-track {
	height: 28px;
	background: #f3f4f6;
	border-radius: 6px;
	overflow: hidden;
}
.quizpio-mount .qp-bar-fill {
	height: 100%;
	border-radius: 6px;
	background: #cbd5e1;
	transition: width 0.4s ease;
}
.quizpio-mount .qp-bar-row.is-correct .qp-bar-fill {
	background: linear-gradient( 90deg, #16a34a 0%, #22c55e 100% );
}
.quizpio-mount .qp-bar-letter {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 5px;
	background: #4f46e5;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	margin-right: 8px;
	flex-shrink: 0;
}
.quizpio-mount .qp-bar-row.is-correct .qp-bar-letter { background: #16a34a; }
.quizpio-mount .qp-bar-count { text-align: right; font-weight: 600; }

/* Leaderboard */
.quizpio-mount .qp-leaderboard {
	background: #f9fafb;
	border-radius: 12px;
	padding: 16px 20px;
}
.quizpio-mount .qp-leaderboard h3 { margin: 0 0 8px; font-size: 16px; color: #4b5563; }
.quizpio-mount .qp-leaderboard ol { margin: 0; padding-left: 24px; }
.quizpio-mount .qp-leaderboard li {
	display: flex; justify-content: space-between;
	padding: 6px 0;
	font-weight: 500;
}
.quizpio-mount .qp-leaderboard .qp-lb-1 { color: #f59e0b; font-weight: 700; }
.quizpio-mount .qp-leaderboard .qp-lb-2 { color: #6b7280; font-weight: 700; }
.quizpio-mount .qp-leaderboard .qp-lb-3 { color: #b45309; font-weight: 700; }

/* Player views */
.quizpio-mount .qp-player {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 16px;
	padding: 24px;
}
.quizpio-mount .qp-waiting { text-align: center; }
.quizpio-mount .qp-nickname-display {
	display: inline-block;
	margin: 12px 0;
	padding: 8px 20px;
	background: #4f46e5;
	color: #fff;
	border-radius: 999px;
	font-weight: 600;
}
.quizpio-mount .qp-result-pill {
	margin-top: 16px;
	padding: 10px 16px;
	border-radius: 999px;
	background: #f3f4f6;
	color: #374151;
	text-align: center;
	font-weight: 600;
}
.quizpio-mount .qp-result-pill.is-correct  { background: #d1fae5; color: #065f46; }
.quizpio-mount .qp-result-pill.is-incorrect { background: #fee2e2; color: #991b1b; }

.quizpio-mount .qp-correct-answer {
	background: #d1fae5;
	color: #065f46;
	padding: 16px 20px;
	border-radius: 12px;
	font-size: 22px;
	font-weight: 700;
	text-align: center;
	margin: 12px 0 16px;
}
.quizpio-mount .qp-my-score, .quizpio-mount .qp-my-rank {
	text-align: center;
	margin: 12px 0;
	font-size: 16px;
}

@media ( max-width: 600px ) {
	.quizpio-mount .qp-options { grid-template-columns: 1fr; }
	.quizpio-mount .qp-bar-row { grid-template-columns: 1fr; }
	.quizpio-mount .qp-bar-count { text-align: left; }
	.quizpio-mount .qp-q-text { font-size: 20px; }
	.quizpio-mount .qp-pin-num { font-size: 36px; }
}
