/**
 * VocabLab — Vocabulary Trainer
 * Styles autonomes (préfixe `vl-`) : le jeu ne dépend d'aucun CSS du thème.
 */

.vl-app {
	--vl-blue: #0a2d57;
	--vl-blue-600: #1b4f8f;
	--vl-accent: #2563eb;
	--vl-ink: #0f172a;
	--vl-muted: #64748b;
	--vl-line: #e2e8f0;
	--vl-bg: #f8fafc;
	--vl-radius: 16px;

	max-width: 860px;
	margin: 0 auto;
	font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
	color: var(--vl-ink);
}

/* ── Entête optionnel ─────────────────────────────────────────────────── */
.vl-header {
	text-align: center;
	margin-bottom: 24px;
}

.vl-badge {
	display: inline-block;
	background: #e0edff;
	color: var(--vl-blue-600);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	padding: 4px 12px;
	border-radius: 999px;
}

.vl-title {
	font-size: 1.75rem;
	font-weight: 800;
	margin: 12px 0 6px;
}

.vl-subtitle {
	color: var(--vl-muted);
	margin: 0;
}

/* ── Barre d'outils ───────────────────────────────────────────────────── */
.vl-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 18px;
}

.vl-deck-picker {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 0.875rem;
	color: var(--vl-muted);
}

.vl-deck-picker__label {
	font-weight: 600;
	white-space: nowrap;
}

.vl-deck-select {
	max-width: 320px;
	padding: 8px 12px;
	border: 1px solid var(--vl-line);
	border-radius: 10px;
	background: #fff;
	color: var(--vl-ink);
	font-size: 0.9rem;
}

.vl-tabs {
	display: inline-flex;
	background: #eef2f7;
	border-radius: 999px;
	padding: 4px;
	gap: 4px;
}

.vl-tab {
	border: 0;
	background: transparent;
	color: var(--vl-muted);
	font-weight: 600;
	font-size: 0.875rem;
	padding: 8px 16px;
	border-radius: 999px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 7px;
	transition: background 0.2s, color 0.2s;
}

.vl-tab.is-active {
	background: #fff;
	color: var(--vl-blue);
	box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

/* ── Progression ──────────────────────────────────────────────────────── */
.vl-progress {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-bottom: 16px;
}

.vl-progress__bar {
	flex: 1;
	height: 8px;
	background: var(--vl-line);
	border-radius: 999px;
	overflow: hidden;
}

.vl-progress__fill {
	display: block;
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, var(--vl-blue), var(--vl-accent));
	border-radius: 999px;
	transition: width 0.3s ease;
}

.vl-progress__count {
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--vl-muted);
	white-space: nowrap;
}

/* ── Carte ────────────────────────────────────────────────────────────── */
.vl-stage {
	perspective: 1400px;
	height: 380px;
	margin-bottom: 20px;
}

.vl-card {
	position: relative;
	width: 100%;
	height: 100%;
	cursor: pointer;
	outline: none;
	transform-style: preserve-3d;
	transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.vl-card.is-flipped {
	transform: rotateY(180deg);
}

.vl-card:focus-visible .vl-card__inner {
	box-shadow: 0 0 0 3px var(--vl-accent);
}

.vl-card__inner {
	position: absolute;
	inset: 0;
}

.vl-card__face {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 32px;
	border-radius: var(--vl-radius);
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
	box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
	text-align: center;
}

.vl-card__front {
	background: linear-gradient(160deg, #ffffff, var(--vl-bg));
	border: 1px solid var(--vl-line);
}

.vl-card__back {
	background: linear-gradient(160deg, var(--vl-blue), var(--vl-blue-600));
	color: #fff;
	transform: rotateY(180deg);
}

.vl-card__content {
	font-size: 2.2rem;
	font-weight: 700;
	line-height: 1.25;
	word-break: break-word;
}

.vl-card__back .vl-card__content {
	font-size: 1.9rem;
	font-weight: 600;
}

.vl-card__hint {
	font-size: 0.8rem;
	color: var(--vl-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.vl-audio {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: 1px solid var(--vl-line);
	background: #fff;
	color: var(--vl-blue);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 1rem;
	transition: transform 0.15s, background 0.15s;
}

.vl-card__back .vl-audio {
	background: rgba(255, 255, 255, 0.16);
	border-color: rgba(255, 255, 255, 0.4);
	color: #fff;
}

.vl-audio:hover {
	transform: scale(1.08);
}

/* ── Contrôles ────────────────────────────────────────────────────────── */
.vl-controls {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
}

.vl-btn {
	border: 0;
	border-radius: 12px;
	padding: 12px 20px;
	font-size: 0.95rem;
	font-weight: 600;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	transition: transform 0.12s, background 0.2s, opacity 0.2s;
}

.vl-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.vl-btn--primary {
	background: var(--vl-blue);
	color: #fff;
}

.vl-btn--primary:hover:not(:disabled) {
	background: var(--vl-blue-600);
}

.vl-btn--ghost {
	background: #fff;
	color: var(--vl-ink);
	border: 1px solid var(--vl-line);
}

.vl-btn--ghost:hover:not(:disabled) {
	background: var(--vl-bg);
}

.vl-btn--icon {
	background: #fff;
	border: 1px solid var(--vl-line);
	color: var(--vl-muted);
	padding: 12px 16px;
}

.vl-btn--icon:hover {
	color: var(--vl-accent);
}

/* ── Quiz ─────────────────────────────────────────────────────────────── */
.vl-quiz-head {
	display: flex;
	justify-content: space-between;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--vl-muted);
	margin-bottom: 22px;
}

.vl-quiz-question {
	font-size: 1.9rem;
	font-weight: 700;
	text-align: center;
	margin: 8px 0 26px;
	min-height: 2.6rem;
}

.vl-quiz-options {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 12px;
}

.vl-quiz-option {
	border: 2px solid var(--vl-line);
	background: #fff;
	border-radius: 12px;
	padding: 16px;
	font-size: 1rem;
	font-weight: 600;
	color: var(--vl-ink);
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s, transform 0.12s;
}

.vl-quiz-option:hover:not(:disabled) {
	border-color: var(--vl-accent);
	transform: translateY(-2px);
}

.vl-quiz-option.is-correct {
	border-color: #16a34a;
	background: #f0fdf4;
	color: #15803d;
}

.vl-quiz-option.is-wrong {
	border-color: #dc2626;
	background: #fef2f2;
	color: #b91c1c;
}

.vl-quiz-option:disabled {
	cursor: default;
}

.vl-quiz-feedback {
	text-align: center;
	font-weight: 600;
	min-height: 1.5rem;
	margin: 18px 0 0;
}

.vl-quiz-feedback.is-correct {
	color: #15803d;
}

.vl-quiz-feedback.is-wrong {
	color: #b91c1c;
}

.vl-quiz-results {
	text-align: center;
	padding: 32px 16px;
}

.vl-quiz-results h3 {
	font-size: 1.5rem;
	font-weight: 800;
	margin: 0 0 10px;
}

.vl-quiz-final {
	font-size: 1.1rem;
	color: var(--vl-muted);
	margin: 0 0 22px;
}

.vl-empty {
	text-align: center;
	color: var(--vl-muted);
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
	.vl-stage {
		height: 300px;
	}

	.vl-card__content {
		font-size: 1.6rem;
	}

	.vl-card__back .vl-card__content {
		font-size: 1.4rem;
	}

	.vl-toolbar {
		justify-content: stretch;
	}

	.vl-deck-picker {
		width: 100%;
	}

	.vl-deck-select {
		flex: 1;
		max-width: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.vl-card,
	.vl-progress__fill,
	.vl-btn,
	.vl-quiz-option {
		transition: none;
	}
}
