/*
 * Quiet House — main.css (пересборка)
 *
 * Mobile-first. Базовый вьюпорт — 390px: весь платный трафик приходит
 * с TikTok и Reels, десктоп здесь вторичен.
 *
 * Токены оставлены от версии 0.1.0 — палитра рабочая.
 */

/* ---------------------------------------------------------------- Токены -- */

:root {
	--bg: #0A0A0C;
	--bg-elevated: #131217;
	--bg-card: #18171c;
	--border: rgba(255, 255, 255, 0.08);

	--text: #F5F5F4;
	--text-muted: #9c9ca6;
	--text-faint: #67666f;

	--accent: #FF2F63;
	--accent-dim: #c81f49;
	--accent-soft: rgba(255, 47, 99, 0.14);
	--gold: #F0B95E;

	--radius: 10px;
	--radius-lg: 16px;

	/* Safe-area на iPhone: плеер занимает весь экран, кнопки не должны
	   уезжать под индикатор home. */
	--safe-top: env(safe-area-inset-top, 0px);
	--safe-bottom: env(safe-area-inset-bottom, 0px);

	--header-h: 56px;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 16px;
	line-height: 1.5;
	/* Горизонтального скролла быть не должно нигде и никогда. */
	overflow-x: hidden;
}

img,
video {
	max-width: 100%;
	display: block;
}

/*
 * Любой display в правилах ниже перебивает браузерный [hidden]{display:none}.
 * Без этой строки скрытые элементы с display:flex/grid остаются видимыми —
 * так, например, наружу вылезало сообщение об ошибке оплаты.
 */
[hidden] {
	display: none !important;
}

button {
	font: inherit;
	color: inherit;
	cursor: pointer;
}

a {
	color: inherit;
	text-decoration: none;
}

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ---------------------------------------------------------------- Шапка --- */

.qh-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 50;
	height: calc(var(--header-h) + var(--safe-top));
	padding: var(--safe-top) 16px 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	/* Градиент вместо заливки: поверх видео-героя плашка выглядит инородно. */
	background: linear-gradient(180deg, rgba(10, 10, 12, 0.92) 0%, rgba(10, 10, 12, 0) 100%);
	transition: background 0.2s ease;
}

.qh-header.is-stuck {
	background: var(--bg);
	border-bottom: 1px solid var(--border);
}

.qh-logo {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 800;
	font-size: 19px;
	letter-spacing: -0.02em;
	color: var(--accent);
}

.qh-logo svg {
	width: 20px;
	height: 20px;
	flex: none;
}

/* ------------------------------------------------------------------ Герой - */

/*
 * Первый экран обязан ПОКАЗАТЬ сериал, а не рассказать про него.
 * Поэтому здесь вертикальное видео на автоплее, а не постер.
 */
.qh-hero {
	position: relative;
	width: 100%;
	/* 9:16, но не выше экрана — иначе кнопка уезжает за фолд. */
	height: min(calc(100vw * 16 / 9), 88svh);
	min-height: 480px;
	overflow: hidden;
	background: #000;
}

.qh-hero__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.qh-hero__scrim {
	position: absolute;
	inset: 0;
	background:
		linear-gradient(180deg, rgba(10, 10, 12, 0.55) 0%, rgba(10, 10, 12, 0) 28%),
		linear-gradient(0deg, var(--bg) 2%, rgba(10, 10, 12, 0.75) 22%, rgba(10, 10, 12, 0) 55%);
	pointer-events: none;
}

.qh-hero__body {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 0 20px calc(24px + var(--safe-bottom));
	display: grid;
	gap: 12px;
}

.qh-hero__meta {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: var(--text-muted);
}

.qh-hero__meta .dot {
	width: 3px;
	height: 3px;
	border-radius: 50%;
	background: var(--text-faint);
}

.qh-hero__title {
	margin: 0;
	font-size: clamp(34px, 11vw, 52px);
	line-height: 0.95;
	font-weight: 900;
	letter-spacing: -0.03em;
	text-transform: uppercase;
}

.qh-hero__tagline {
	margin: 0;
	font-size: 16px;
	color: var(--text-muted);
	max-width: 34ch;
}

/* Кнопка звука — видео стартует без него, иначе браузер не даст автоплей. */
.qh-hero__sound {
	position: absolute;
	right: 16px;
	bottom: calc(50% - 20px);
	width: 40px;
	height: 40px;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(8px);
	color: #fff;
}

/* ------------------------------------------------------------------ CTA --- */

.qh-cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-height: 52px;
	padding: 0 24px;
	border: 0;
	border-radius: var(--radius);
	background: var(--accent);
	color: #fff;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: -0.01em;
}

.qh-cta:active {
	background: var(--accent-dim);
}

.qh-cta--ghost {
	background: rgba(255, 255, 255, 0.1);
	color: var(--text);
}

.qh-cta__note {
	margin: 0;
	text-align: center;
	font-size: 13px;
	color: var(--text-faint);
}

/* ---------------------------------------------------------------- Секции -- */

.qh-section {
	padding: 28px 0 8px;
}

.qh-section__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	/* Тот же отступ, что и у шапки: раньше здесь был 0 и заголовок
	   упирался в левый край экрана. */
	padding: 0 16px 12px;
}

.qh-section__title {
	margin: 0;
	font-size: 15px;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--text);
}

.qh-section__link {
	font-size: 14px;
	color: var(--accent);
	white-space: nowrap;
}

/* ---------------------------------------------------- Карусель эпизодов --- */

.qh-rail {
	display: flex;
	gap: 10px;
	padding: 0 16px 4px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.qh-rail::-webkit-scrollbar {
	display: none;
}

.qh-card {
	flex: 0 0 auto;
	width: 132px;
	scroll-snap-align: start;
	display: grid;
	gap: 6px;
}

.qh-card__art {
	position: relative;
	/* Постеры вертикальные: контент 9:16, горизонтальные превью его резали. */
	aspect-ratio: 9 / 16;
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--bg-card);
}

.qh-card__art img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.qh-card__no {
	position: absolute;
	left: 8px;
	bottom: 8px;
	font-size: 13px;
	font-weight: 800;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.qh-badge {
	position: absolute;
	top: 8px;
	left: 8px;
	padding: 3px 7px;
	border-radius: 6px;
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.qh-badge--free {
	background: var(--accent);
	color: #fff;
}

.qh-badge--locked {
	background: rgba(0, 0, 0, 0.65);
	color: var(--gold);
	backdrop-filter: blur(4px);
}

.qh-card--locked .qh-card__art img {
	filter: brightness(0.42) saturate(0.6);
}

.qh-card__lock {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	color: var(--gold);
}

.qh-card__title {
	margin: 0;
	font-size: 12px;
	line-height: 1.3;
	color: var(--text-muted);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* --------------------------------------------------- Обрыв после эп. 8 ---- */

/*
 * Визуальный разрыв между бесплатной и платной зоной. Стоит прямо в карусели,
 * чтобы зритель увидел границу заранее, а не упёрся в неё внезапно.
 */
.qh-break {
	flex: 0 0 auto;
	width: 150px;
	display: grid;
	align-content: center;
	justify-items: center;
	gap: 8px;
	padding: 16px 12px;
	text-align: center;
	border: 1px dashed rgba(240, 185, 94, 0.35);
	border-radius: var(--radius);
	background: linear-gradient(180deg, rgba(240, 185, 94, 0.06), transparent);
}

.qh-break__title {
	font-size: 13px;
	font-weight: 800;
	color: var(--gold);
}

.qh-break__text {
	font-size: 11px;
	line-height: 1.35;
	color: var(--text-faint);
}

/* --------------------------------------------------------------- Модалки -- */

.qh-overlay {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: grid;
	align-items: end;
	background: rgba(0, 0, 0, 0.72);
	backdrop-filter: blur(6px);
}

.qh-overlay[hidden] {
	display: none;
}

.qh-sheet {
	position: relative;
	width: 100%;
	max-height: 92svh;
	overflow-y: auto;
	padding: 24px 20px calc(24px + var(--safe-bottom));
	border-radius: var(--radius-lg) var(--radius-lg) 0 0;
	background: var(--bg-elevated);
	border-top: 1px solid var(--border);
	display: grid;
	gap: 16px;
	animation: qh-rise 0.22s ease;
}

@keyframes qh-rise {
	from {
		transform: translateY(16px);
		opacity: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.qh-sheet {
		animation: none;
	}
}

.qh-sheet__close {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 32px;
	height: 32px;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
}

.qh-sheet__title {
	margin: 0;
	padding-right: 40px;
	font-size: 22px;
	font-weight: 800;
	letter-spacing: -0.02em;
}

.qh-sheet__sub {
	margin: 0;
	font-size: 14px;
	color: var(--text-muted);
}

/* ------------------------------------------------------------- Офферы ----- */

.qh-offers {
	display: grid;
	gap: 10px;
}

.qh-offer {
	position: relative;
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 14px 16px;
	text-align: left;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-card);
}

.qh-offer[aria-pressed="true"] {
	border-color: var(--accent);
	background: var(--accent-soft);
}

.qh-offer__name {
	font-size: 15px;
	font-weight: 700;
}

.qh-offer__desc {
	font-size: 12px;
	color: var(--text-muted);
}

.qh-offer__price {
	font-size: 18px;
	font-weight: 800;
	white-space: nowrap;
}

.qh-offer__tag {
	position: absolute;
	top: -8px;
	right: 12px;
	padding: 2px 8px;
	border-radius: 5px;
	background: var(--gold);
	color: #241a06;
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

/*
 * Разовая покупка вместо автопродления — поэтому здесь можно и нужно
 * писать прямым текстом, что списание одно. Это снимает половину поводов
 * для рефанда ещё до оплаты.
 */
.qh-offer-note {
	margin: 0;
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: var(--text-faint);
}

/* Мягкая подсказка, если жмут Continue без выбранного тарифа. */
.qh-choose-hint {
	margin: 10px 0 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	font-size: 13px;
	font-weight: 600;
	color: var(--gold);
	text-align: center;
}

.qh-choose-hint svg {
	flex-shrink: 0;
}

@keyframes qh-nudge {
	0%, 100% { transform: translateY(0); }
	35% { transform: translateY(-5px); }
	70% { transform: translateY(0); }
}

.qh-offers.qh-nudge {
	animation: qh-nudge 0.45s ease;
}

/* ---------------------------------------------------------------- Футер --- */

.qh-footer {
	margin-top: 32px;
	padding: 24px 16px calc(32px + var(--safe-bottom));
	border-top: 1px solid var(--border);
	display: grid;
	gap: 14px;
	font-size: 13px;
	color: var(--text-faint);
}

.qh-footer__links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 18px;
	padding: 0;
	margin: 0;
	list-style: none;
}

.qh-footer__links a {
	color: var(--text-muted);
}

/* ----------------------------------------------------------- Десктоп ------ */

@media (min-width: 900px) {
	:root {
		--header-h: 64px;
	}

	.qh-header,
	.qh-section__head,
	.qh-rail,
	.qh-footer {
		padding-left: max(32px, calc((100vw - 1200px) / 2));
		padding-right: max(32px, calc((100vw - 1200px) / 2));
	}

	.qh-hero {
		height: 78svh;
		min-height: 560px;
	}

	/* На десктопе вертикальное видео не растягиваем на всю ширину —
	   держим колонку по центру, по бокам приглушённый фон. */
	.qh-hero__video {
		width: auto;
		height: 100%;
		left: 50%;
		transform: translateX(-50%);
		object-fit: contain;
	}

	.qh-hero__body {
		padding-left: max(32px, calc((100vw - 1200px) / 2));
		padding-bottom: 40px;
		max-width: 640px;
	}

	.qh-cta {
		width: auto;
		min-width: 260px;
	}

	.qh-card {
		width: 168px;
	}

	.qh-overlay {
		align-items: center;
		justify-items: center;
	}

	.qh-sheet {
		width: min(460px, 92vw);
		border-radius: var(--radius-lg);
		border: 1px solid var(--border);
	}
}

/* ===========================================================================
 * Блоки витрины: счётчики, синопсис, каст, отзывы
 * ======================================================================== */

/* Полоса-маркер прототипа. В прод не едет — существует только чтобы
   демо-числа нельзя было принять за настоящие. */
.qh-demo-strip {
	position: relative;
	z-index: 60;
	padding: 7px 16px;
	background: repeating-linear-gradient(45deg, #2a2410, #2a2410 10px, #221d0d 10px, #221d0d 20px);
	border-bottom: 1px solid rgba(240, 185, 94, 0.3);
	color: var(--gold);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-align: center;
}

/* ------------------------------------------------------ Счётчики ---------- */

.qh-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1px;
	margin: 0;
	padding: 0;
	background: var(--border);
	border-block: 1px solid var(--border);
}

.qh-stat {
	display: grid;
	gap: 2px;
	padding: 14px 8px;
	background: var(--bg);
	text-align: center;
}

.qh-stat__value {
	font-size: 20px;
	font-weight: 800;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}

.qh-stat__value .qh-star {
	color: var(--gold);
}

.qh-stat__label {
	font-size: 11px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--text-faint);
}

/* Счётчик просмотров на карточке эпизода. */
.qh-card__views {
	display: flex;
	align-items: center;
	gap: 4px;
	font-size: 11px;
	color: var(--text-faint);
	font-variant-numeric: tabular-nums;
}

.qh-card__views svg {
	flex: none;
	opacity: 0.7;
}

/* -------------------------------------------------------- Синопсис -------- */

.qh-about {
	padding: 24px 16px 4px;
	display: grid;
	gap: 12px;
}

.qh-about__text {
	margin: 0;
	font-size: 15px;
	line-height: 1.6;
	color: var(--text-muted);
}

.qh-about__text strong {
	color: var(--text);
	font-weight: 600;
}

.qh-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.qh-tag {
	padding: 5px 10px;
	border: 1px solid var(--border);
	border-radius: 999px;
	font-size: 12px;
	color: var(--text-muted);
}

/* ------------------------------------------------------------ Каст -------- */

.qh-cast {
	display: flex;
	gap: 10px;
	padding: 0 16px 4px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.qh-cast::-webkit-scrollbar {
	display: none;
}

.qh-person {
	flex: 0 0 auto;
	width: 116px;
	scroll-snap-align: start;
	display: grid;
	gap: 6px;
	/* элемент — кнопка: сбрасываем дефолты */
	border: 0;
	padding: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.qh-person:active {
	transform: scale(0.97);
}

.qh-person__art {
	aspect-ratio: 2 / 3;
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--bg-card);
}

.qh-person__art img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.qh-person__name {
	margin: 0;
	font-size: 13px;
	font-weight: 700;
}

.qh-person__role {
	margin: 0;
	font-size: 11px;
	line-height: 1.35;
	color: var(--text-faint);
}

/* Bottom-sheet персонажа */
.qh-char-head {
	display: flex;
	gap: 14px;
	align-items: flex-start;
	margin-bottom: 14px;
}

.qh-char__art {
	flex: 0 0 auto;
	width: 84px;
	aspect-ratio: 2 / 3;
	border-radius: var(--radius);
	background: var(--bg-card) center / cover no-repeat;
	display: grid;
	place-items: center;
	font-size: 28px;
	font-weight: 800;
	color: var(--text-faint);
}

.qh-char-meta {
	padding-top: 4px;
}

.qh-char__role {
	margin: 6px 0 0;
	font-size: 13px;
	font-weight: 600;
	color: var(--accent);
}

.qh-char__bio {
	margin: 0;
	font-size: 14px;
	line-height: 1.6;
	color: var(--text-muted);
}

/* ---------------------------------------------------------- Отзывы -------- */

.qh-reviews {
	display: flex;
	gap: 10px;
	padding: 0 16px 4px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.qh-reviews::-webkit-scrollbar {
	display: none;
}

.qh-review {
	flex: 0 0 auto;
	width: 258px;
	scroll-snap-align: start;
	display: grid;
	gap: 8px;
	align-content: start;
	padding: 14px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-card);
}

.qh-review__head {
	display: flex;
	align-items: center;
	gap: 8px;
}

.qh-review__avatar {
	width: 30px;
	height: 30px;
	flex: none;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: var(--accent-soft);
	color: var(--accent);
	font-size: 12px;
	font-weight: 800;
}

.qh-review__who {
	display: grid;
	line-height: 1.25;
}

.qh-review__name {
	font-size: 13px;
	font-weight: 700;
}

.qh-review__date {
	font-size: 11px;
	color: var(--text-faint);
}

.qh-review__stars {
	margin-left: auto;
	font-size: 12px;
	color: var(--gold);
	letter-spacing: 1px;
}

.qh-review__text {
	margin: 0;
	font-size: 13px;
	line-height: 1.5;
	color: var(--text-muted);
}

/* Сводка рейтинга: крупный балл слева, гистограмма справа. */
.qh-rating {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 20px;
	align-items: center;
	margin: 0 16px 16px;
	padding: 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-card);
}

.qh-rating__score {
	display: grid;
	justify-items: center;
	gap: 2px;
}

.qh-rating__big {
	font-size: 38px;
	font-weight: 900;
	line-height: 1;
	letter-spacing: -0.03em;
}

.qh-rating__stars {
	color: var(--gold);
	font-size: 13px;
	letter-spacing: 1px;
}

.qh-rating__count {
	font-size: 11px;
	color: var(--text-faint);
	white-space: nowrap;
}

.qh-rating__bars {
	display: grid;
	gap: 5px;
}

.qh-bar {
	display: grid;
	grid-template-columns: 24px 1fr 32px;
	align-items: center;
	gap: 8px;
	font-size: 11px;
	color: var(--text-faint);
	font-variant-numeric: tabular-nums;
}

.qh-bar__track {
	height: 5px;
	border-radius: 3px;
	background: rgba(255, 255, 255, 0.08);
	overflow: hidden;
}

.qh-bar__fill {
	display: block;
	height: 100%;
	border-radius: 3px;
	background: var(--gold);
}

.qh-bar__pct {
	text-align: right;
}

/* ---------------------------------------------------------- Форма отзыва -- */

.qh-input {
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: #111015;
	color: var(--text);
	font: inherit;
	font-size: 15px;
	resize: vertical;
}

.qh-input::placeholder {
	color: var(--text-faint);
}

.qh-input:focus {
	outline: none;
	border-color: var(--accent);
}

.qh-review-form,
.qh-review-cta {
	margin: 14px 16px 4px;
	padding: 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-card);
}

.qh-review-form__label {
	margin: 0 0 8px;
	font-size: 13px;
	font-weight: 700;
	color: var(--text-muted);
}

.qh-stars-input {
	display: flex;
	gap: 4px;
	margin-bottom: 12px;
}

.qh-star-btn {
	padding: 2px;
	border: 0;
	background: transparent;
	font-size: 30px;
	line-height: 1;
	color: rgba(255, 255, 255, 0.16);
	cursor: pointer;
	transition: color 0.12s ease, transform 0.12s ease;
}

.qh-star-btn.is-on {
	color: var(--gold);
}

.qh-star-btn:active {
	transform: scale(0.88);
}

.qh-review-form .qh-cta {
	margin-top: 12px;
}

.qh-form-msg {
	margin: 10px 0 0;
	font-size: 12.5px;
	color: var(--text-muted);
}

.qh-form-msg--err {
	color: var(--accent);
}

.qh-review-cta {
	text-align: center;
}

.qh-review-cta__text {
	margin: 0 0 12px;
	font-size: 14px;
	color: var(--text-muted);
}

/* ===========================================================================
 * Сетка всех эпизодов (страница «All 29»)
 * ======================================================================== */

.qh-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
	gap: 12px 10px;
	padding: 0 16px 24px;
}

.qh-grid .qh-card {
	width: auto;
}

.qh-page-head {
	padding: calc(var(--header-h) + var(--safe-top) + 20px) 16px 16px;
	display: grid;
	gap: 6px;
}

.qh-page-head h1 {
	margin: 0;
	font-size: 26px;
	font-weight: 900;
	letter-spacing: -0.02em;
}

.qh-page-head p {
	margin: 0;
	font-size: 14px;
	color: var(--text-muted);
}

/* ===========================================================================
 * Плеер
 * ======================================================================== */

/* Гасим pull-to-refresh на странице плеера: свайп вниз = прошлая серия, а не перезагрузка. */
body.single-episode {
	overscroll-behavior-y: none;
}

.qh-player {
	position: fixed;
	inset: 0;
	background: #000;
	display: grid;
	place-items: center;
	overflow: hidden;
}

/* In-page оверлей (главная/сериал): поверх контента, но под оффер-шитом (z-index 100). */
.qh-player--overlay {
	z-index: 80;
}

.qh-player[hidden] {
	display: none !important;
}

body.qh-player-open {
	overflow: hidden;
}

.qh-player__stage {
	position: relative;
	width: 100%;
	height: 100%;
	/* Вертикаль без леттербокса: контент 9:16, экран телефона тоже. */
	max-width: calc(100svh * 9 / 16);
	margin-inline: auto;
	background: #000;
	/* Все жесты обрабатываем сами (свайп между сериями) — иначе браузер перехватывает
	   вертикальные движения и переключение работает рвано. */
	touch-action: none;
}

.qh-player__media {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Постер-превью поверх видео, пока идёт загрузка/буферизация — чтобы не мигал чёрный экран. */
.qh-player__poster {
	position: absolute;
	inset: 0;
	background: #000 center / cover no-repeat;
	pointer-events: none;
	transition: opacity 0.25s ease;
}

.qh-player__poster.is-hidden {
	opacity: 0;
}

/* Лента серий: рельс из 3 слайдов (пред/тек/след), сдвигается свайпом. */
.qh-player__reel {
	position: absolute;
	inset: 0;
	transition: transform 0.34s cubic-bezier(0.22, 0.61, 0.36, 1);
	will-change: transform;
}

.qh-slide {
	position: absolute;
	left: 0;
	width: 100%;
	height: 100%;
	/* top задаётся из JS: -100% (пред) / 0 (тек) / 100% (след) */
}

.qh-slide__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	background: #000;
}

.qh-slide__poster {
	position: absolute;
	inset: 0;
	background: #000 center / cover no-repeat;
	pointer-events: none;
	transition: opacity 0.25s ease;
}

.qh-slide__poster.is-hidden {
	opacity: 0;
}

/* Плашка «звук выключен» (после muted-автозапуска). */
.qh-player__sound {
	position: absolute;
	top: 62px;
	right: 14px;
	z-index: 6;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	border: 0;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(6px);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
}

.qh-player__scrim {
	position: absolute;
	inset: 0;
	background:
		linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 22%),
		linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 30%);
	pointer-events: none;
}

/* Верхняя панель: назад, номер эпизода, прогресс по сериалу. */
.qh-player__top {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	padding: calc(12px + var(--safe-top)) 14px 0;
	display: grid;
	gap: 10px;
}

.qh-player__row {
	display: flex;
	align-items: center;
	gap: 12px;
}

.qh-icon-btn {
	width: 36px;
	height: 36px;
	flex: none;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.42);
	backdrop-filter: blur(8px);
	color: #fff;
}

.qh-player__ep {
	font-size: 14px;
	font-weight: 700;
}

.qh-player__ep small {
	display: block;
	font-size: 11px;
	font-weight: 400;
	color: rgba(255, 255, 255, 0.65);
}

/* Полоска эпизодов сериала — по одному делению на серию. */
.qh-ticks {
	display: flex;
	gap: 2px;
}

.qh-tick {
	flex: 1;
	height: 2px;
	border-radius: 1px;
	background: rgba(255, 255, 255, 0.22);
}

.qh-tick.is-done {
	background: rgba(255, 255, 255, 0.6);
}

.qh-tick.is-current {
	background: var(--accent);
}

/* Нижняя панель: таймлайн текущего эпизода. */
.qh-player__bottom {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 0 14px calc(16px + var(--safe-bottom));
	display: grid;
	gap: 8px;
}

.qh-player__title {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

.qh-seek {
	position: relative;
	height: 3px;
	border-radius: 2px;
	background: rgba(255, 255, 255, 0.25);
	cursor: pointer;
	touch-action: none; /* драг по полосе перематывает, а не листает страницу */
}

/* Невидимая расширенная тап-зона — по 16px сверху/снизу, чтобы в полоску можно было попасть пальцем. */
.qh-seek::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: -16px;
	bottom: -16px;
}

.qh-seek__fill {
	position: absolute;
	inset: 0 auto 0 0;
	width: 0;
	border-radius: 2px;
	background: var(--accent);
}

.qh-player__time {
	display: flex;
	justify-content: space-between;
	font-size: 11px;
	color: rgba(255, 255, 255, 0.7);
	font-variant-numeric: tabular-nums;
}

/* Крупная кнопка play по центру — появляется на паузе. */
.qh-player__play {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	border: 0;
	background: transparent;
	color: #fff;
	opacity: 0;
	transition: opacity 0.15s ease;
}

.qh-player.is-paused .qh-player__play {
	opacity: 1;
}

.qh-player__play span {
	width: 68px;
	height: 68px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.45);
	backdrop-filter: blur(6px);
}

/* Подсказка про свайп — показываем один раз на первом эпизоде. */
.qh-swipe-hint {
	position: absolute;
	left: 50%;
	bottom: 22%;
	transform: translateX(-50%);
	display: grid;
	justify-items: center;
	gap: 4px;
	font-size: 12px;
	color: rgba(255, 255, 255, 0.8);
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
	animation: qh-bob 1.8s ease-in-out infinite;
	pointer-events: none;
}

@keyframes qh-bob {
	50% {
		transform: translate(-50%, -8px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.qh-swipe-hint {
		animation: none;
	}
}

/* Экран пейвола прямо в плеере — на последнем кадре предыдущего эпизода. */
.qh-player__gate {
	position: absolute;
	inset: 0;
	display: grid;
	align-content: center;
	justify-items: center;
	gap: 14px;
	padding: 24px;
	text-align: center;
	background: rgba(10, 10, 12, 0.82);
	backdrop-filter: blur(10px);
}

.qh-player__gate h2 {
	margin: 0;
	font-size: 24px;
	font-weight: 800;
	letter-spacing: -0.02em;
}

.qh-player__gate p {
	margin: 0;
	font-size: 14px;
	color: var(--text-muted);
	max-width: 30ch;
}

.qh-player__gate .qh-cta {
	width: auto;
	min-width: 240px;
}

@media (min-width: 900px) {
	.qh-grid {
		grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
		gap: 18px 14px;
		padding-left: max(32px, calc((100vw - 1200px) / 2));
		padding-right: max(32px, calc((100vw - 1200px) / 2));
	}

	.qh-about,
	.qh-cast,
	.qh-reviews,
	.qh-page-head {
		padding-left: max(32px, calc((100vw - 1200px) / 2));
		padding-right: max(32px, calc((100vw - 1200px) / 2));
	}

	.qh-stats {
		grid-template-columns: repeat(3, minmax(0, 220px));
		justify-content: start;
		padding-left: max(32px, calc((100vw - 1200px) / 2));
	}

	.qh-about__text {
		max-width: 68ch;
	}
}
