/* Fits theme content column; centered card on desktop */
.fni-quiz-wrap {
	display: grid;
	justify-items: center;
	width: 100%;
	box-sizing: border-box;
}

.fni-quiz-app {
	width: min(100%, 56rem);
	max-width: 56rem;
	margin: 0;
	background: #fff;
	border-radius: 0.875rem;
	box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
	overflow: hidden;
	border: 1px solid #e5e7eb;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: #1f2937;
	box-sizing: border-box;
}

.fni-quiz-app *,
.fni-quiz-app *::before,
.fni-quiz-app *::after {
	box-sizing: border-box;
}

.fni-quiz-content {
	padding: 1rem 1.25rem 1.25rem;
}

.fni-quiz-header {
	width: 100%;
	aspect-ratio: 21 / 9;
	max-height: 220px;
	background: #f1f5f9;
	overflow: hidden;
	flex-shrink: 0;
}

.fni-quiz-header img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center center;
	display: block;
}

.fni-quiz-app--has-header .fni-quiz-content {
	padding-top: 1.25rem;
}

.fni-error {
	color: #b91c1c;
	padding: 1rem;
	background: #fef2f2;
	border-radius: 0.5rem;
}

.fni-fade-in {
	animation: fniFadeIn 0.35s ease-out;
}

@keyframes fniFadeIn {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

/* Start screen */
.fni-start-screen {
	text-align: center;
	padding: clamp(1.5rem, 4vw, 2.5rem) clamp(0.75rem, 3vw, 1.5rem);
}

.fni-start-screen h1 {
	font-size: clamp(1.35rem, 3vw, 2.125rem);
	font-weight: 700;
	color: #1e3a8a;
	margin: 0 0 0.75rem;
	line-height: 1.25;
}

.fni-start-screen p {
	color: #4b5563;
	margin: 0 auto 1.5rem;
	max-width: 42rem;
	line-height: 1.55;
	font-size: clamp(0.9rem, 2vw, 1.0625rem);
}

.fni-btn {
	border: none;
	cursor: pointer;
	font-weight: 700;
	border-radius: 9999px;
	transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.fni-btn-primary {
	background: #2563eb;
	color: #fff;
	padding: 0.75rem 2rem;
	font-size: 1.0625rem;
	box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.fni-btn-primary:hover {
	background: #1d4ed8;
}

.fni-btn-primary:active {
	transform: scale(0.98);
}

/* Slide layout */
.fni-slide {
	display: flex;
	flex-direction: column;
	gap: 0.875rem;
	min-height: 0;
}

.fni-slide-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.75rem;
	padding-bottom: 0.75rem;
	border-bottom: 1px solid #e5e7eb;
	flex-shrink: 0;
}

.fni-slide-header h2 {
	margin: 0;
	font-size: clamp(1rem, 2vw, 1.375rem);
	line-height: 1.2;
	flex: 1;
	min-width: 0;
	font-weight: 700;
}

.fni-step-badge {
	font-size: 0.8125rem;
	font-weight: 600;
	color: #475569;
	background: #f1f5f9;
	padding: 0.3rem 0.75rem;
	border-radius: 9999px;
	white-space: nowrap;
	flex-shrink: 0;
}

/* Options grid */
.fni-options-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: clamp(0.625rem, 1.2vw, 1rem);
	width: 100%;
}

.fni-options-grid[data-count="3"] {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.fni-options-grid[data-count="5"],
.fni-options-grid[data-count="6"] {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.fni-option-card {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 0.75rem;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
	display: flex;
	flex-direction: column;
	min-width: 0;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.fni-option-card:has(.fni-selected-cunoscut),
.fni-option-card:has(.fni-selected-necunoscut) {
	border-color: #cbd5e1;
	box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

/* Image — centered, no head crop */
.fni-option-image {
	position: relative;
	width: 100%;
	aspect-ratio: 1;
	background: #f1f5f9;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	flex-shrink: 0;
}

.fni-option-image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: center center;
	display: block;
}

.fni-option-body {
	padding: 0.625rem 0.75rem 0.75rem;
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
	gap: 0.5rem;
}

.fni-option-name {
	text-align: center;
	font-weight: 700;
	font-size: clamp(0.8125rem, 1.4vw, 1rem);
	margin: 0;
	line-height: 1.25;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.fni-answer-buttons {
	display: flex;
	gap: 0.375rem;
	margin-top: auto;
	min-width: 0;
	width: 100%;
}

.fni-btn-answer {
	flex: 1 1 0;
	min-width: 0;
	max-width: 100%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.25rem;
	padding: 0.45rem 0.25rem;
	border: 1.5px solid transparent;
	font-weight: 700;
	font-size: clamp(0.5625rem, 1vw, 0.75rem);
	border-radius: 0.5rem;
	cursor: pointer;
	transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
	line-height: 1.1;
	min-height: 2rem;
	overflow: hidden;
}

.fni-btn-answer:active {
	transform: scale(0.97);
}

.fni-btn-icon {
	width: 0.875rem;
	height: 0.875rem;
	flex-shrink: 0;
}

.fni-btn-label {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Cunoscut — green hint */
.fni-btn-cunoscut {
	background: #ecfdf5;
	color: #047857;
	border-color: #6ee7b7;
}

.fni-btn-cunoscut:hover {
	background: #d1fae5;
	border-color: #34d399;
}

.fni-btn-cunoscut.fni-selected-cunoscut {
	background: #10b981;
	color: #fff;
	border-color: #10b981;
	box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

/* Necunoscut — red hint */
.fni-btn-necunoscut {
	background: #fef2f2;
	color: #b91c1c;
	border-color: #fca5a5;
}

.fni-btn-necunoscut:hover {
	background: #fee2e2;
	border-color: #f87171;
}

.fni-btn-necunoscut.fni-selected-necunoscut {
	background: #ef4444;
	color: #fff;
	border-color: #ef4444;
	box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
}

.fni-slide-footer {
	display: flex;
	justify-content: flex-end;
	padding-top: 0.75rem;
	border-top: 1px solid #f1f5f9;
	flex-shrink: 0;
}

.fni-btn-next {
	padding: 0.7rem 1.75rem;
	border-radius: 0.625rem;
	font-weight: 700;
	font-size: 0.9375rem;
	border: none;
	cursor: pointer;
	transition: background 0.2s, opacity 0.2s, transform 0.15s;
}

.fni-btn-next.enabled {
	background: #2563eb;
	color: #fff;
	box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.fni-btn-next.enabled:hover {
	background: #1d4ed8;
}

.fni-btn-next.enabled:active {
	transform: scale(0.98);
}

.fni-btn-next.disabled {
	background: #e5e7eb;
	color: #9ca3af;
	cursor: not-allowed;
}

/* Results */
.fni-results {
	text-align: center;
	padding: clamp(1.5rem, 4vw, 2.5rem) 1rem;
}

.fni-results h2 {
	font-size: clamp(1.35rem, 3vw, 1.875rem);
	font-weight: 700;
	margin: 0 0 0.5rem;
}

.fni-results-message {
	font-size: clamp(1rem, 2vw, 1.25rem);
	color: #4b5563;
	margin-bottom: 1.25rem;
}

.fni-score-box {
	display: inline-block;
	background: #eff6ff;
	border: 1px solid #dbeafe;
	border-radius: 1rem;
	padding: clamp(1rem, 3vw, 2rem);
	margin-bottom: 1.25rem;
}

.fni-score-value {
	font-size: clamp(2rem, 6vw, 3rem);
	font-weight: 800;
	color: #2563eb;
	margin-bottom: 0.35rem;
	line-height: 1;
}

.fni-score-label {
	color: #374151;
	font-weight: 500;
	font-size: clamp(0.875rem, 2vw, 1rem);
}

.fni-results-teaser {
	font-size: clamp(0.9rem, 2vw, 1.0625rem);
	color: #374151;
	max-width: 32rem;
	margin: 0 auto 1.25rem;
	line-height: 1.45;
}

.fni-btn-restart {
	background: none;
	border: none;
	color: #2563eb;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 4px;
	cursor: pointer;
	font-size: 0.9375rem;
}

.fni-btn-restart:hover {
	color: #1e40af;
}

.fni-submitting {
	opacity: 0.7;
	pointer-events: none;
}

.fni-slide-loading {
	text-align: center;
	padding: 2rem 1rem;
}

.fni-loading-text {
	margin: 0;
	color: #6b7280;
}

.fni-quiz-honeypot {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
	opacity: 0;
	pointer-events: none;
}

.fni-results-blocked .fni-results-message {
	margin-bottom: 1rem;
}

.fni-completed-at {
	font-size: 0.875rem;
	color: #6b7280;
	margin-top: 0.75rem;
}

/* Desktop */
@media (min-width: 768px) {
	.fni-quiz-content {
		padding: 1.25rem 1.5rem 1.5rem;
	}

	.fni-option-image {
		aspect-ratio: 4 / 3;
	}

	.fni-btn-answer {
		min-height: 2.25rem;
		padding: 0.5rem 0.5rem;
		gap: 0.35rem;
	}

	.fni-btn-icon {
		width: 1rem;
		height: 1rem;
	}
}

/* Mobile — tight 2×2 */
@media (max-width: 639px) {
	.fni-quiz-app {
		max-width: 100%;
		border-radius: 0.625rem;
	}

	.fni-quiz-header {
		aspect-ratio: 16 / 9;
		max-height: 140px;
	}

	.fni-quiz-content {
		padding: 0.5rem;
	}

	.fni-start-screen {
		padding: 1rem 0.375rem;
	}

	.fni-start-screen h1 {
		font-size: 1.15rem;
	}

	.fni-start-screen p {
		font-size: 0.8125rem;
		margin-bottom: 0.875rem;
	}

	.fni-slide {
		gap: 0.375rem;
	}

	.fni-slide-header {
		padding-bottom: 0.375rem;
	}

	.fni-slide-header h2 {
		font-size: 0.875rem;
	}

	.fni-step-badge {
		font-size: 0.6875rem;
		padding: 0.15rem 0.45rem;
	}

	.fni-options-grid,
	.fni-options-grid[data-count="2"],
	.fni-options-grid[data-count="3"],
	.fni-options-grid[data-count="5"],
	.fni-options-grid[data-count="6"] {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 0.375rem;
	}

	.fni-option-image {
		aspect-ratio: 1;
		max-height: clamp(4.5rem, 24vw, 6rem);
	}

	.fni-option-body {
		padding: 0.3rem 0.35rem 0.35rem;
		gap: 0.25rem;
	}

	.fni-option-name {
		font-size: 0.6875rem;
	}

	.fni-answer-buttons {
		flex-direction: column;
		gap: 0.2rem;
	}

	.fni-btn-answer {
		width: 100%;
		flex: none;
		min-height: 1.55rem;
		padding: 0.28rem 0.35rem;
		font-size: 0.5625rem;
		border-radius: 0.35rem;
		gap: 0.2rem;
		border-width: 1px;
		letter-spacing: 0.01em;
	}

	.fni-btn-icon {
		width: 0.7rem;
		height: 0.7rem;
	}

	.fni-btn-label {
		position: static;
		width: auto;
		height: auto;
		margin: 0;
		overflow: visible;
		clip: auto;
		white-space: nowrap;
		font-size: 0.5625rem;
	}

	.fni-slide-footer {
		padding-top: 0.375rem;
	}

	.fni-btn-next {
		width: 100%;
		padding: 0.55rem 1rem;
		font-size: 0.8125rem;
	}
}

@media (max-width: 639px) and (max-height: 700px) {
	.fni-option-image {
		max-height: clamp(3.75rem, 20vw, 5rem);
	}

	.fni-option-name {
		font-size: 0.625rem;
		-webkit-line-clamp: 1;
	}

	.fni-btn-answer {
		min-height: 1.45rem;
		padding: 0.22rem 0.3rem;
		font-size: 0.5rem;
	}

	.fni-btn-label {
		font-size: 0.5rem;
	}
}

/* tagDiv Newspaper theme compatibility */
.td-page-content .fni-quiz-wrap,
.tagdiv-type .fni-quiz-wrap {
	display: grid;
	justify-items: center;
	width: 100%;
	clear: both;
	float: none;
}

.td-page-content .fni-quiz-app,
.tagdiv-type .fni-quiz-app {
	width: min(100%, 56rem);
	max-width: 56rem;
	margin-left: auto;
	margin-right: auto;
	float: none;
	clear: both;
}

/* Shortcode: [fni_chestionar id="1" fullwidth="1"] — hide sidebar, use full content row */
.td-pb-row:has(.fni-quiz-wrap--fullwidth) .td-pb-span4,
.td-pb-row:has(.fni-quiz-wrap--fullwidth) .td-main-sidebar {
	display: none !important;
}

.td-pb-row:has(.fni-quiz-wrap--fullwidth) .td-pb-span8,
.td-pb-row:has(.fni-quiz-wrap--fullwidth) .td-main-content {
	width: 100% !important;
	float: none !important;
}
