/**
 * Hebrew Kids Trivia Game – Styles
 *
 * @package HebrewKidsTriviaGame
 */

:root {
	--hkt-primary: #4a90d9;
	--hkt-secondary: #f5a623;
	--hkt-success: #2ecc71;
	--hkt-error: #e74c3c;
	--hkt-bg: #f0f7ff;
	--hkt-card-bg: #ffffff;
	--hkt-text: #2c3e50;
	--hkt-text-muted: #6b7c93;
	--hkt-radius: 16px;
	--hkt-radius-sm: 10px;
	--hkt-shadow: 0 4px 20px rgba(74, 144, 217, 0.15);
	--hkt-font: "Segoe UI", Tahoma, Arial, "Helvetica Neue", sans-serif;
	--hkt-transition: 0.2s ease;
}

/* Wrapper */
.hkt-game-wrapper {
	direction: rtl;
	font-family: var(--hkt-font);
	color: var(--hkt-text);
	max-width: 640px;
	margin: 0 auto;
	padding: 16px;
	box-sizing: border-box;
}

.hkt-game-wrapper *,
.hkt-game-wrapper *::before,
.hkt-game-wrapper *::after {
	box-sizing: border-box;
}

/* Card */
.hkt-card {
	background: var(--hkt-card-bg);
	border-radius: var(--hkt-radius);
	box-shadow: var(--hkt-shadow);
	padding: 24px 20px;
}

.hkt-card--playing {
	padding: 20px 16px;
}

.hkt-card--results {
	text-align: center;
}

/* Header */
.hkt-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 20px;
	gap: 12px;
}

.hkt-title {
	margin: 0;
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--hkt-primary);
	line-height: 1.3;
}

.hkt-subtitle {
	margin: 0 0 16px;
	color: var(--hkt-text-muted);
	font-size: 1rem;
	text-align: center;
}

/* Buttons */
.hkt-btn {
	display: block;
	width: 100%;
	padding: 14px 20px;
	margin-bottom: 10px;
	border: none;
	border-radius: var(--hkt-radius-sm);
	font-size: 1.1rem;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	transition: background var(--hkt-transition), transform var(--hkt-transition), box-shadow var(--hkt-transition);
	text-align: center;
	line-height: 1.4;
}

.hkt-btn:last-child {
	margin-bottom: 0;
}

.hkt-btn:focus {
	outline: 3px solid var(--hkt-secondary);
	outline-offset: 2px;
}

.hkt-btn:focus:not(:focus-visible) {
	outline: none;
}

.hkt-btn:focus-visible {
	outline: 3px solid var(--hkt-secondary);
	outline-offset: 2px;
}

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

.hkt-btn--primary:hover {
	filter: brightness(1.08);
}

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

.hkt-btn--secondary {
	background: #e8f2fc;
	color: var(--hkt-primary);
}

.hkt-btn--secondary:hover {
	background: #d4e8f8;
}

.hkt-btn--mode {
	background: linear-gradient(135deg, var(--hkt-primary), #6ba8e5);
	color: #fff;
	font-size: 1.15rem;
	padding: 16px 20px;
}

.hkt-btn--mode:hover {
	filter: brightness(1.06);
}

.hkt-btn--text {
	background: transparent;
	color: var(--hkt-text-muted);
	font-size: 0.95rem;
	text-decoration: underline;
	padding: 10px;
}

.hkt-btn--icon {
	width: auto;
	padding: 8px 12px;
	font-size: 1.3rem;
	margin-bottom: 0;
	background: #f0f4f8;
	border-radius: 50%;
	min-width: 44px;
	min-height: 44px;
}

/* Modes */
.hkt-modes {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* Form elements */
.hkt-label {
	display: block;
	margin-bottom: 6px;
	font-weight: 600;
	font-size: 0.95rem;
}

.hkt-select {
	width: 100%;
	padding: 12px 14px;
	margin-bottom: 16px;
	border: 2px solid #dce6f0;
	border-radius: var(--hkt-radius-sm);
	font-size: 1rem;
	font-family: inherit;
	background: #fff;
	direction: rtl;
}

.hkt-select:focus {
	outline: none;
	border-color: var(--hkt-primary);
	box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.25);
}

/* Meta info */
.hkt-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 12px;
	margin-bottom: 12px;
	font-size: 0.85rem;
	color: var(--hkt-text-muted);
}

.hkt-meta-item strong {
	color: var(--hkt-primary);
}

.hkt-score-display {
	margin-right: auto;
	font-weight: 600;
}

/* Progress bar */
.hkt-progress {
	height: 10px;
	background: #e8f0f8;
	border-radius: 99px;
	overflow: hidden;
	margin-bottom: 12px;
}

.hkt-progress__fill {
	height: 100%;
	background: linear-gradient(90deg, var(--hkt-primary), var(--hkt-secondary));
	border-radius: 99px;
	transition: width 0.4s ease;
}

/* Timer */
.hkt-timer {
	text-align: center;
	font-size: 1rem;
	margin-bottom: 16px;
	padding: 8px;
	background: #f8fafc;
	border-radius: var(--hkt-radius-sm);
}

.hkt-timer--generous {
	opacity: 0.7;
}

.hkt-timer--hidden {
	display: none;
}

.hkt-timer-value {
	font-weight: 700;
	font-size: 1.3rem;
	color: var(--hkt-primary);
}

.hkt-timer-value.hkt-timer--urgent {
	color: var(--hkt-error);
}

/* Question */
.hkt-question {
	font-size: 1.25rem;
	font-weight: 600;
	line-height: 1.5;
	margin: 0 0 20px;
	text-align: center;
}

/* Answers – 2×2 cube grid */
.hkt-answers--grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.hkt-answers--count-3 .hkt-answer-cube:last-child {
	grid-column: 1 / -1;
	max-width: calc(50% - 6px);
	justify-self: center;
}

.hkt-answer-cube {
	width: 100%;
	max-width: 100%;
	padding: 12px 10px 14px;
	border: 2px solid #6b7c93;
	border-radius: var(--hkt-radius);
	background: #ffffff;
	color: #111827;
	font-family: inherit;
	font-weight: 600;
	cursor: pointer;
	text-align: center;
	transition: border-color var(--hkt-transition), background var(--hkt-transition), box-shadow var(--hkt-transition), transform var(--hkt-transition), color var(--hkt-transition);
	min-height: 128px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	box-shadow: 0 2px 8px rgba(44, 62, 80, 0.08);
	overflow: hidden;
	box-sizing: border-box;
}

.hkt-answer-cube__media {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 56px;
	width: 100%;
	flex-shrink: 0;
}

.hkt-answer-cube__emoji {
	font-size: 2.5rem;
	line-height: 1;
	display: block;
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.12));
}

.hkt-answer-cube__img {
	width: 56px;
	height: 56px;
	display: block;
	border-radius: 12px;
	object-fit: contain;
}

.hkt-answer-cube__label {
	display: block;
	width: 100%;
	max-width: 100%;
	font-size: 0.88rem;
	line-height: 1.3;
	font-weight: 700;
	overflow-wrap: anywhere;
	word-break: break-word;
	white-space: normal;
	hyphens: auto;
	padding: 0 2px;
	box-sizing: border-box;
}

.hkt-answer-btn {
	width: 100%;
	padding: 16px 18px;
	border: 2px solid #6b7c93;
	border-radius: var(--hkt-radius-sm);
	background: #ffffff;
	color: #111827;
	font-size: 1.05rem;
	font-family: inherit;
	font-weight: 600;
	cursor: pointer;
	text-align: center;
	transition: border-color var(--hkt-transition), background var(--hkt-transition), box-shadow var(--hkt-transition), color var(--hkt-transition);
	min-height: 52px;
	line-height: 1.4;
}

.hkt-answer-cube.hkt-answer-btn {
	padding: 12px 10px 14px;
	border-radius: var(--hkt-radius);
	min-height: 128px;
}

/* High-contrast hover – overrides theme button styles (e.g. white text on light blue). */
.hkt-game-wrapper .hkt-answers .hkt-answer-btn:hover:not(:disabled):not(.hkt-answer-btn--correct):not(.hkt-answer-btn--wrong),
.hkt-game-wrapper .hkt-answers .hkt-answer-cube:hover:not(:disabled):not(.hkt-answer-btn--correct):not(.hkt-answer-btn--wrong) {
	background-color: #fffbeb !important;
	color: #111827 !important;
	border-color: #b45309 !important;
	box-shadow: 0 0 0 2px #f59e0b, 0 4px 12px rgba(245, 158, 11, 0.2) !important;
	transform: translateY(-1px);
}

.hkt-game-wrapper .hkt-answers .hkt-answer-btn:focus:not(:disabled):not(.hkt-answer-btn--correct):not(.hkt-answer-btn--wrong),
.hkt-game-wrapper .hkt-answers .hkt-answer-cube:focus:not(:disabled):not(.hkt-answer-btn--correct):not(.hkt-answer-btn--wrong) {
	background-color: #fffbeb !important;
	color: #111827 !important;
	border-color: #b45309 !important;
	box-shadow: 0 0 0 3px #f59e0b !important;
}

.hkt-answer-btn:focus {
	outline: none;
}

.hkt-answer-btn:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px #f59e0b !important;
}

.hkt-answer-btn--correct,
.hkt-answer-cube.hkt-answer-btn--correct {
	border-color: var(--hkt-success) !important;
	background: #e8f8ef !important;
	color: #1a7a42;
	font-weight: 700;
	box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.25) !important;
	transform: none;
}

.hkt-answer-btn--wrong,
.hkt-answer-cube.hkt-answer-btn--wrong {
	border-color: var(--hkt-error) !important;
	background: #fdecea !important;
	color: #c0392b;
	box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2) !important;
	transform: none;
}

.hkt-answer-btn:disabled {
	cursor: default;
	opacity: 0.85;
}

/* Feedback */
.hkt-live-region {
	min-height: 1.5em;
	text-align: center;
	font-weight: 600;
	margin-top: 12px;
	font-size: 1rem;
}

.hkt-feedback {
	padding: 16px;
	border-radius: var(--hkt-radius-sm);
	text-align: center;
	font-size: 1.2rem;
	font-weight: 700;
	margin-bottom: 16px;
}

.hkt-feedback--correct {
	background: #e8f8ef;
	color: #1a7a42;
}

.hkt-feedback--wrong {
	background: #fdecea;
	color: #c0392b;
}

.hkt-correct-reveal {
	text-align: center;
	font-weight: 600;
	margin-bottom: 12px;
}

.hkt-explanation {
	text-align: center;
	color: var(--hkt-text-muted);
	margin-bottom: 16px;
	line-height: 1.5;
}

/* Stars */
.hkt-star {
	font-size: 1.5rem;
	color: #ddd;
}

.hkt-star--filled {
	color: var(--hkt-secondary);
}

.hkt-results-stars {
	margin: 16px 0;
}

.hkt-results-stars .hkt-star {
	font-size: 2.5rem;
}

.hkt-results-title {
	font-size: 1.4rem;
	margin: 0 0 8px;
	color: var(--hkt-primary);
}

.hkt-results-score,
.hkt-results-accuracy,
.hkt-results-total,
.hkt-results-note {
	font-size: 1.1rem;
	margin: 8px 0;
}

.hkt-results-note {
	font-size: 0.95rem;
	color: var(--hkt-text-muted);
	text-align: center;
}

.hkt-results-total {
	font-weight: 700;
	color: var(--hkt-primary);
	text-align: center;
}

.hkt-results-actions {
	margin-top: 20px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* Campaign stages */
.hkt-stages-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 10px;
	margin: 16px 0;
}

.hkt-stage-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 14px 10px;
	border: 2px solid #dce6f0;
	border-radius: var(--hkt-radius-sm);
	background: #fff;
	cursor: pointer;
	font-family: inherit;
	min-height: 80px;
	transition: border-color var(--hkt-transition), background var(--hkt-transition);
	position: relative;
}

.hkt-stage-btn:hover:not(.hkt-stage-btn--locked) {
	border-color: var(--hkt-primary);
	background: #f0f7ff;
}

.hkt-stage-btn:focus {
	outline: 3px solid var(--hkt-secondary);
	outline-offset: 2px;
}

.hkt-stage-btn--locked {
	opacity: 0.55;
	cursor: not-allowed;
	background: #f5f5f5;
}

.hkt-stage-btn--done {
	border-color: var(--hkt-success);
}

.hkt-stage-num {
	font-weight: 700;
	font-size: 0.95rem;
	margin-bottom: 4px;
}

.hkt-stage-stars {
	line-height: 1;
}

.hkt-stage-stars .hkt-star {
	font-size: 1rem;
}

.hkt-stage-best {
	font-size: 0.75rem;
	color: var(--hkt-text-muted);
	margin-top: 4px;
}

.hkt-lock {
	position: absolute;
	top: 6px;
	left: 6px;
	font-size: 0.9rem;
}

/* Reset */
.hkt-reset-wrap {
	margin-top: 20px;
	text-align: center;
}

/* Loading */
.hkt-loading {
	text-align: center;
	padding: 40px;
	color: var(--hkt-text-muted);
	font-size: 1.1rem;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.hkt-btn,
	.hkt-answer-btn,
	.hkt-progress__fill,
	.hkt-stage-btn {
		transition: none;
	}

	.hkt-btn--primary:active,
	.hkt-btn--mode:active {
		transform: none;
	}
}

/* Responsive */
@media (min-width: 480px) {
	.hkt-stages-grid {
		grid-template-columns: repeat(3, 1fr);
	}

	.hkt-title {
		font-size: 1.75rem;
	}

	.hkt-question {
		font-size: 1.35rem;
	}
}

@media (min-width: 600px) {
	.hkt-game-wrapper {
		padding: 24px;
	}

	.hkt-card {
		padding: 28px 24px;
	}

	.hkt-stages-grid {
		grid-template-columns: repeat(5, 1fr);
	}
}
