/* Сброс стилей и базовые настройки */
:root {
	--vh: 1vh;
	--dvh: 1dvh;
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
	color: white;
	margin: 0;
	padding: 0;
	height: 100vh;
	height: 100dvh;
	/* Динамический viewport height для мобильных */
	height: calc(var(--vh, 1vh) * 100);
	/* Fallback для старых браузеров */
	overflow: hidden;
	/* Предотвращаем масштабирование на мобильных */
	-webkit-text-size-adjust: 100%;
	-ms-text-size-adjust: 100%;
}

.container {
	height: 100vh;
	height: 100dvh;
	/* Динамический viewport height для мобильных */
	height: calc(var(--vh, 1vh) * 100);
	/* Fallback для старых браузеров */
	display: flex;
	flex-direction: column;
	background: rgba(0, 0, 0, 0.8);
	backdrop-filter: blur(10px);
	/* Важно для правильной работы flex на мобильных */
	min-height: 0;
	overflow: hidden;
}

/* Заголовок */
header {
	padding: 15px 20px;
	background: rgba(0, 0, 0, 0.5);
	border-bottom: 2px solid #4ecdc4;
	position: relative;
	flex-shrink: 0;
}

.header-content {
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 100%;
}

h1 {
	font-size: 2.2em;
	margin: 0;
	text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
	color: white;
	display: flex;
	align-items: center;
	gap: 10px;
}

.logo {
	width: 4em;
	height: auto;
	vertical-align: middle;
}

.progress {
	font-size: 1.2em;
	color: white;
	background: rgba(255, 255, 255, 0.1);
	padding: 6px 15px;
	border-radius: 15px;
	display: inline-block;
	font-weight: bold;
}

.stats {
	display: flex;
	gap: 8px;
	margin-top: 8px;
}

.stat-chip {
	font-size: 2em;
	color: white;
	padding: 10px 20px;
	border-radius: 15px;
	font-weight: bold;
	display: inline-block;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.correct-chip {
	background: linear-gradient(45deg, #4caf50, #45a049);
}

.incorrect-chip {
	background: linear-gradient(45deg, #f44336, #d32f2f);
}

/* Основной контент */
main {
	flex: 1;
	display: flex;
	flex-direction: row;
	overflow: hidden;
	/* Важно для правильной работы flex на мобильных */
	min-height: 0;
}

.question-container {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	align-items: stretch;
	padding: 20px;
	background: rgba(0, 0, 0, 0.3);
	border-right: 2px solid #4ecdc4;
	text-align: center;
}

.question {
	font-size: 4em;
	line-height: 1.1;
	margin-bottom: 20px;
	padding: 20px;
	text-align: left;
	font-weight: bold;
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: flex-start;
	word-wrap: break-word;
	hyphens: manual;
}

.question-level {
	font-size: 0.4em;
	color: #4ecdc4;
	margin-bottom: 15px;
	font-weight: bold;
	text-transform: uppercase;
	letter-spacing: 1px;
}

.question-text {
	font-size: 1em;
	line-height: 1.3;
}

.final-results {
	text-align: center;
	width: 100%;
}

.final-results h2 {
	font-size: 0.8em;
	color: #4ecdc4;
	margin-bottom: 20px;
	text-transform: uppercase;
	letter-spacing: 1px;
}

.final-results p {
	font-size: 0.6em;
	line-height: 1.4;
	color: white;
}

.speak-btn {
	background: linear-gradient(45deg, #4ecdc4, #44a08d);
	color: white;
	border: none;
	padding: 25px 25px;
	border-radius: 20px;
	font-size: 1.1em;
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: 0 3px 10px rgba(78, 205, 196, 0.3);
	margin: 0 10px;
	display: none;
	/* Скрываем кнопку озвучки */
}

.speak-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 5px 15px rgba(78, 205, 196, 0.4);
}

.speak-btn:active {
	transform: translateY(0);
}

/* Варианты ответов */
.options {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 20px;
	overflow-y: auto;
	justify-content: center;
}

.option-btn {
	background: rgba(255, 255, 255, 0.1);
	color: white;
	border: 2px solid rgba(255, 255, 255, 0.2);
	padding: 20px 25px;
	border-radius: 12px;
	font-size: 4em;
	cursor: pointer;
	transition: all 0.3s ease;
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	text-align: left;
	word-wrap: break-word;
	hyphens: auto;
	width: 100%;
	font-weight: 500;
}

.option-btn:hover {
	background: rgba(255, 255, 255, 0.2);
	border-color: #4ecdc4;
	transform: translateY(-1px);
}

.option-btn.correct {
	background: linear-gradient(45deg, #4ecdc4, #44a08d);
	border-color: #4ecdc4;
	animation: pulse 0.6s ease-in-out;
}

.option-btn.incorrect {
	background: linear-gradient(45deg, #ff6b6b, #ee5a52);
	border-color: #ff6b6b;
	animation: shake 0.6s ease-in-out;
}

/* Результат */
.result {
	text-align: center;
	font-size: 3em;
	font-weight: bold;
	margin: 10px 0;
	padding: 10px;
	border-radius: 8px;
	opacity: 0;
	transition: opacity 0.3s ease;
	position: absolute;
	top: 10%;
	left: 30%;
	transform: translate(-50%, -50%);
	z-index: 100;
	min-width: 200px;
}

.result.show {
	opacity: 1;
}

.result.correct {
	background: rgb(78, 205, 197);
	color: #00524d;
}

.result.incorrect {
	background: rgb(255, 107, 107);
	color: #540000;
}

/* Кнопка меню */
.menu-btn {
	background: rgba(255, 255, 255, 0.1);
	color: white;
	border: none;
	padding: 10px;
	border-radius: 50%;
	font-size: 1.2em;
	cursor: pointer;
	transition: all 0.3s ease;
	width: 45px;
	height: 45px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.menu-btn:hover {
	background: rgba(255, 255, 255, 0.2);
	transform: scale(1.1);
}

/* Футер */
footer {
	padding: 15px 20px;
	background: rgba(0, 0, 0, 0.5);
	border-top: 2px solid #4ecdc4;
	flex-shrink: 0;
	/* Гарантируем что футер всегда виден */
	position: relative;
	z-index: 10;
}

.footer-buttons {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 15px;
}

/* Контейнер для кнопок в поле вопроса */
.question-buttons {
	display: flex;
	gap: 15px;
	margin-top: 20px;
	justify-content: space-between;
	align-items: center;
}

/* Кнопка перезапуска */
.restart-btn {
	background: linear-gradient(45deg, #ff6b6b, #ee5a52);
	color: white;
	border: none;
	padding: 35px 25px;
	border-radius: 15px;
	font-size: 1.2em;
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: 0 3px 10px rgba(255, 107, 107, 0.3);
	flex: 1;
}

/* Кнопка пропуска */
.skip-btn {
	background: linear-gradient(45deg, #feca57, #ff9ff3);
	color: white;
	border: none;
	padding: 35px 25px;
	border-radius: 15px;
	font-size: 1.2em;
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: 0 3px 10px rgba(254, 202, 87, 0.3);
	flex: 1;
}

.restart-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.skip-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 5px 15px rgba(254, 202, 87, 0.4);
}

/* Меню настроек */
.settings-menu {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.8);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 1000;
	backdrop-filter: blur(5px);
	/* Добавляем прокрутку для узких экранов */
	overflow-y: auto;
	padding: 20px;
	box-sizing: border-box;
}

.settings-menu.show {
	display: flex;
}

.settings-content {
	background: rgba(0, 0, 0, 0.9);
	padding: 30px;
	border-radius: 20px;
	max-width: 400px;
	width: 90%;
	border: 2px solid #4ecdc4;
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
	/* Убираем фиксированную высоту для прокрутки */
	max-height: none;
	margin: auto;
}

.settings-content h3 {
	text-align: center;
	margin-bottom: 25px;
	color: #4ecdc4;
	font-size: 1.5em;
}

.setting-group {
	margin-bottom: 20px;
}

.setting-group label {
	display: block;
	margin-bottom: 8px;
	color: #b0b0b0;
	font-size: 1em;
}

.setting-group select,
.setting-group input[type="range"] {
	width: 100%;
	padding: 10px;
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 8px;
	color: white;
	font-size: 1em;
}

.setting-group select option {
	background: #333;
	color: white;
}

.setting-group input[type="range"] {
	height: 6px;
	background: rgba(255, 255, 255, 0.1);
	outline: none;
	cursor: pointer;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
	appearance: none;
	width: 20px;
	height: 20px;
	background: #4ecdc4;
	border-radius: 50%;
	cursor: pointer;
}

.setting-group span {
	display: inline-block;
	margin-left: 10px;
	color: #4ecdc4;
	font-weight: bold;
	min-width: 30px;
}

.setting-buttons {
	display: flex;
	gap: 15px;
	margin-top: 25px;
}

.close-btn,
.test-btn {
	flex: 1;
	padding: 12px 20px;
	border: none;
	border-radius: 8px;
	font-size: 1em;
	cursor: pointer;
	transition: all 0.3s ease;
}

.close-btn {
	background: rgba(255, 255, 255, 0.1);
	color: white;
}

.close-btn:hover {
	background: rgba(255, 255, 255, 0.2);
}

.test-btn {
	background: linear-gradient(45deg, #4ecdc4, #44a08d);
	color: white;
}

.test-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 5px 15px rgba(78, 205, 196, 0.3);
}

.reset-btn {
	background: rgba(255, 107, 107, 0.2);
	color: white;
	border: 1px solid rgba(255, 107, 107, 0.5);
	padding: 8px 15px;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.3s ease;
	font-size: 0.9em;
}

.reset-btn:hover {
	background: rgba(255, 107, 107, 0.3);
	transform: translateY(-2px);
}

.reload-btn {
	background: rgba(255, 193, 7, 0.2);
	color: white;
	border: 1px solid rgba(255, 193, 7, 0.5);
	padding: 8px 15px;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.3s ease;
	font-size: 0.9em;
}

.reload-btn:hover {
	background: rgba(255, 193, 7, 0.3);
	transform: translateY(-2px);
}

/* Анимации */
@keyframes pulse {

	0%,
	100% {
		transform: scale(1);
	}

	50% {
		transform: scale(1.05);
	}
}

@keyframes shake {

	0%,
	100% {
		transform: translateX(0);
	}

	25% {
		transform: translateX(-5px);
	}

	75% {
		transform: translateX(5px);
	}
}

/* Адаптивность для магнитолы */
@media (max-width: 800px) {
	main {
		flex-direction: column;
		min-height: 0;
		/* Важно для правильного расчета flex */
	}

	.question-container {
		border-right: none;
		border-bottom: 2px solid #4ecdc4;
		flex-shrink: 0;
		padding: 10px;
		justify-content: space-between;
	}

	.question-buttons {
		gap: 10px;
		margin-top: 15px;
	}

	.restart-btn {
		padding: 25px 20px;
		font-size: 1em;
	}

	.skip-btn {
		padding: 25px 20px;
		font-size: 1em;
	}

	.question {
		font-size: 2.8em;
		padding: 10px;
		justify-content: center;
		text-align: center;
		align-items: flex-start;
		margin-bottom: 10px;
	}

	.question-level {
		font-size: 0.45em;
		margin-bottom: 12px;
	}

	.question-buttons {
		gap: 12px;
		margin-top: 15px;
	}

	.restart-btn {
		padding: 22px 20px;
		font-size: 0.9em;
	}

	.skip-btn {
		padding: 22px 20px;
		font-size: 0.9em;
	}

	.options {
		flex-direction: row;
		flex-wrap: wrap;
		gap: 6px;
		padding: 8px;
		flex: 1;
		min-height: 0;
	}

	.option-btn {
		flex: 1;
		min-width: calc(50% - 3px);
		padding: 10px 8px;
		font-size: 1.3em;
		min-height: 45px;
	}

	h1 {
		font-size: 1.3em;
	}

	.logo {
		width: 1.5em;
		height: auto;
	}

	.progress {
		font-size: 0.9em;
		padding: 4px 10px;
	}

	.stats {
		gap: 5px;
		margin-top: 5px;
	}

	.stat-chip {
		font-size: 1em;
		padding: 4px 8px;
	}

	.stats {
		gap: 6px;
		margin-top: 6px;
	}

	.stat-chip {
		font-size: 1.1em;
		padding: 5px 10px;
	}

	.footer-buttons {
		flex-direction: row;
		gap: 8px;
		flex-wrap: wrap;
	}

	.speak-btn,
	.restart-btn {
		padding: 10px 15px;
		font-size: 0.9em;
		flex: 1;
		min-width: 120px;
	}

	footer {
		padding: 10px 15px;
	}
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
	h1 {
		font-size: 1.1em;
	}

	.logo {
		width: 1.2em;
		height: auto;
	}

	.progress {
		font-size: 0.8em;
		padding: 3px 8px;
	}

	.stats {
		gap: 4px;
		margin-top: 4px;
	}

	.stat-chip {
		font-size: 1em;
		padding: 4px 8px;
	}

	.question {
		font-size: 2em;
		padding: 8px;
		align-items: flex-start;
		margin-bottom: 8px;
	}

	.question-level {
		font-size: 0.5em;
		margin-bottom: 10px;
	}

	.question-buttons {
		gap: 8px;
		margin-top: 12px;
	}

	.restart-btn {
		padding: 20px 18px;
		font-size: 0.9em;
	}

	.skip-btn {
		padding: 20px 18px;
		font-size: 0.9em;
	}

	.speak-btn,
	.restart-btn {
		padding: 8px 12px;
		font-size: 0.8em;
		min-width: 100px;
	}

	.options {
		padding: 6px;
		gap: 4px;
	}

	.option-btn {
		padding: 6px 6px;
		font-size: 1em;
		min-height: 35px;
	}

	.footer-buttons {
		gap: 6px;
	}

	.settings-content {
		padding: 15px;
		margin: 8px;
	}

	.setting-buttons {
		flex-direction: column;
	}

	.menu-btn {
		width: 35px;
		height: 35px;
		font-size: 0.9em;
	}

	header {
		padding: 8px 12px;
	}

	footer {
		padding: 8px 12px;
	}
}

/* Специальная адаптация для низких экранов (магнитолы) */
@media (max-height: 600px) {
	header {
		padding: 6px 12px;
	}

	h1 {
		font-size: 1em;
		margin: 0;
	}

	.logo {
		width: 3em;
		height: auto;
	}

	.progress {
		font-size: 0.8em;
		padding: 3px 8px;
	}

	.question-container {
		padding: 6px 10px;
		flex-shrink: 0;
	}

	.question {
		font-size: 2.2em;
		padding: 8px;
		margin-bottom: 6px;
		align-items: flex-start;
	}

	.speak-btn {
		padding: 6px 12px;
		font-size: 0.8em;
	}

	.result {
		font-size: 0.9em;
		padding: 6px;
		min-width: 120px;
	}

	.options {
		padding: 4px 10px;
		gap: 4px;
		flex: 1;
		min-height: 0;
	}

	.option-btn {
		padding: 6px 8px;
		font-size: 1.5em;
		min-height: 40px;
	}

	footer {
		padding: 12px 15px;
		flex-shrink: 0;
	}

	.restart-btn {
		padding: 8px 15px;
		font-size: 0.8em;
	}

	.footer-buttons {
		gap: 8px;
	}

	.speak-btn,
	.restart-btn {
		padding: 8px 15px;
		font-size: 0.8em;
	}

	/* Адаптация меню настроек для низких экранов */
	.settings-menu {
		padding: 20px;
		align-items: flex-start;
	}

	.settings-content {
		padding: 30px;
		margin: 20px auto;
		max-width: 400px;
	}

	.setting-buttons {
		flex-direction: column;
		gap: 12px;
		margin-top: 25px;
	}

	.close-btn,
	.test-btn,
	.reset-btn,
	.reload-btn {
		padding: 12px 18px;
		font-size: 1em;
	}
}

/* Для очень низких экранов (магнитолы с высотой менее 500px) */
@media (max-height: 500px) {
	header {
		padding: 4px 8px;
	}

	h1 {
		font-size: 0.9em;
	}

	.logo {
		width: 1em;
	}

	.progress {
		font-size: 0.7em;
		padding: 2px 6px;
	}

	.question-container {
		padding: 4px 8px;
	}

	.question {
		font-size: 1.8em;
		padding: 6px;
		margin-bottom: 4px;
	}

	.question-level {
		font-size: 0.55em;
		margin-bottom: 8px;
	}

	.question-buttons {
		gap: 8px;
		margin-top: 10px;
	}

	.restart-btn {
		padding: 18px 15px;
		font-size: 0.7em;
	}

	.skip-btn {
		padding: 18px 15px;
		font-size: 0.7em;
	}

	.options {
		padding: 2px 8px;
		gap: 3px;
	}

	.option-btn {
		padding: 4px 6px;
		font-size: 1.5em;
		min-height: 30px;
	}

	footer {
		padding: 10px 12px;
	}



	.footer-buttons {
		gap: 6px;
	}

	.menu-btn {
		width: 30px;
		height: 30px;
		font-size: 0.8em;
	}

	/* Адаптация меню настроек для низких экранов */
	.settings-menu {
		padding: 15px;
		align-items: flex-start;
	}

	.settings-content {
		padding: 25px;
		margin: 15px auto;
		max-width: 380px;
	}

	.setting-buttons {
		flex-direction: column;
		gap: 10px;
		margin-top: 20px;
	}

	.close-btn,
	.test-btn,
	.reset-btn,
	.reload-btn {
		padding: 10px 15px;
		font-size: 0.9em;
	}
}

/* Для экстремально низких экранов (менее 400px высоты) */
@media (max-height: 400px) {
	header {
		padding: 3px 6px;
	}

	h1 {
		font-size: 0.8em;
	}

	.logo {
		width: 2em;
	}

	.progress {
		font-size: 0.6em;
		padding: 1px 4px;
	}

	.question-container {
		padding: 3px 6px;
	}

	.question {
		font-size: 2em;
		padding: 4px;
		margin-bottom: 3px;
	}

	.question-level {
		font-size: 0.6em;
		margin-bottom: 6px;
	}

	.question-buttons {
		gap: 6px;
		margin-top: 8px;
	}

	.restart-btn {
		padding: 15px 12px;
		font-size: 0.6em;
	}

	.skip-btn {
		padding: 15px 12px;
		font-size: 0.6em;
	}

	.options {
		padding: 1px 6px;
		gap: 2px;
	}

	.option-btn {
		padding: 3px 4px;
		font-size: 1.5em;
		min-height: 25px;
	}

	footer {
		padding: 8px 10px;
	}



	.footer-buttons {
		gap: 4px;
	}

	.menu-btn {
		width: 25px;
		height: 25px;
		font-size: 0.7em;
	}

	/* Адаптация меню настроек для низких экранов */
	.settings-menu {
		padding: 10px;
		align-items: flex-start;
	}

	.settings-content {
		padding: 20px;
		margin: 10px auto;
		max-width: 350px;
	}

	.settings-content h3 {
		font-size: 1.2em;
		margin-bottom: 15px;
	}

	.setting-group {
		margin-bottom: 15px;
	}

	.setting-group label {
		font-size: 0.9em;
		margin-bottom: 5px;
	}

	.setting-buttons {
		flex-direction: column;
		gap: 8px;
		margin-top: 20px;
	}

	.close-btn,
	.test-btn,
	.reset-btn,
	.reload-btn {
		padding: 8px 12px;
		font-size: 0.8em;
	}
}

/* Для очень узких экранов (менее 400px) */
@media (max-width: 400px) {
	h1 {
		font-size: 1em;
	}

	.logo {
		width: 1em;
	}

	.progress {
		font-size: 0.7em;
		padding: 2px 6px;
	}

	.question {
		font-size: 1.6em;
		padding: 6px;
	}

	.question-level {
		font-size: 0.6em;
		margin-bottom: 8px;
	}

	.question-buttons {
		gap: 8px;
		margin-top: 10px;
	}

	.restart-btn {
		padding: 18px 15px;
		font-size: 0.7em;
	}

	.skip-btn {
		padding: 18px 15px;
		font-size: 0.7em;
	}

	.option-btn {
		font-size: 2em;
		padding: 6px 6px;
		min-height: 35px;
	}

	.footer-buttons {
		flex-direction: column;
		gap: 4px;
	}
}