/* =================== ПЕРЕМЕННЫЕ =================== */
:root {
	--bg: #0b0e18;
	--bg-soft: #12172b;
	--card: #151c36;
	--card-2: #101428;
	--brand: #4f8cff;
	--text: #e6e9f1;
	--muted: #aab1c7;
	--line: #242a45;
	--chip: #1a2142;
	--chip-on: #263064;
	--danger: #ff7aa6;
	--ok: #7be2b4;
	--warn: #ffcf66;
}

/* =================== БАЗОВЫЕ СТИЛИ =================== */
* {
	box-sizing: border-box;
}

html, body {
	height: 100%;
	margin: 0;
	padding: 0;
}

body {
	background: var(--bg);
	font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
	color: var(--text);
	font-size: 14px;
	line-height: 1.4;
	overflow: hidden;
}

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

button {
	font: inherit;
	cursor: pointer;
}

/* =================== ОСНОВНОЙ LAYOUT =================== */
.container {
	height: 100vh;
	display: grid;
	grid-template-columns: 280px 1fr;
	grid-template-rows: 56px 1fr;
	grid-template-areas: 
		"top top"
		"side main";
}

.container.vod-mode {
	grid-template-columns: 1fr;
	grid-template-areas: 
		"top"
		"main";
}

/* =================== ВЕРХНЯЯ ПАНЕЛЬ =================== */
.top {
	grid-area: top;
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 0 16px;
	border-bottom: 1px solid var(--line);
	background: linear-gradient(180deg, #0f1428, #0c1122);
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
}

.brand .logo {
	width: 26px;
	height: 26px;
	background: linear-gradient(135deg, var(--brand), #8f73ff);
	border-radius: 6px;
}

.brand strong {
	font-weight: 800;
	letter-spacing: 0.2px;
}

.tabs {
	display: flex;
	gap: 6px;
	margin-left: 12px;
}

.tab {
	padding: 8px 12px;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--chip);
	color: var(--muted);
	cursor: pointer;
	transition: all 0.2s ease;
}

.tab.active {
	background: var(--chip-on);
	color: var(--text);
	border-color: #2a3563;
}

.grow {
	flex: 1;
}

/* Кнопка меню для мобильных */
.menu-toggle {
	display: none;
	width: 40px;
	height: 40px;
	border: 1px solid var(--line);
	background: var(--chip);
	border-radius: 8px;
	color: var(--text);
	cursor: pointer;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
}

.menu-toggle:hover {
	background: var(--chip-on);
	border-color: var(--brand);
}

/* Оверлей для мобильного меню */
.menu-overlay {
	display: none;
	position: fixed;
	top: 56px;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 999;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.menu-overlay.open {
	display: block;
	opacity: 1;
}

.search {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border: 1px solid var(--line);
	background: var(--card-2);
	border-radius: 10px;
	min-width: 260px;
}

.search input {
	background: transparent;
	border: 0;
	outline: none;
	color: var(--text);
	width: 200px;
}

.pill {
	padding: 8px 10px;
	border: 1px solid var(--line);
	background: var(--card-2);
	border-radius: 10px;
}

/* =================== БОКОВАЯ ПАНЕЛЬ =================== */
.side {
	grid-area: side;
	border-right: 1px solid var(--line);
	background: linear-gradient(180deg, #0f1428, #0a0f20);
	display: flex;
	flex-direction: column;
	width: 280px;
	max-width: 280px;
	overflow-y: auto;
	overflow-x: hidden;
}

.side .section {
	padding: 14px 12px 8px;
	color: var(--muted);
	font-weight: 600;
	font-size: 12px;
	text-transform: uppercase;
}

/* Группы каналов */
.groups {
	position: relative;
	padding: 10px 10px 16px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	overflow: auto;
	-ms-overflow-style: none;
	scrollbar-width: none;
}

.groups::-webkit-scrollbar {
	display: none;
}

.groups::before,
.groups::after {
	content: "";
	position: sticky;
	left: 0;
	right: 0;
	height: 16px;
	pointer-events: none;
	z-index: 1;
}

.groups::before {
	top: 0;
	background: linear-gradient(180deg, rgba(5, 8, 17, 0.9), rgba(5, 8, 17, 0));
	margin-bottom: -16px;
}

.groups::after {
	bottom: 0;
	background: linear-gradient(0deg, rgba(5, 8, 17, 0.9), rgba(5, 8, 17, 0));
	margin-top: -16px;
}

.group-chip {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 10px;
	border-radius: 10px;
	background: linear-gradient(180deg, rgba(32, 41, 84, 0.35), rgba(16, 20, 40, 0.35)) border-box;
	border: 1px solid #1f2650;
	color: var(--text);
	cursor: pointer;
	transition: all 0.15s ease;
	backdrop-filter: saturate(120%) blur(4px);
	font-size: 13px;
}

.group-chip:hover {
	transform: translateX(3px);
	border-color: #2a3563;
	box-shadow: 0 3px 10px rgba(20, 30, 70, 0.25);
}

.group-chip.active {
	border-color: var(--brand);
	background: linear-gradient(180deg, rgba(79, 140, 255, 0.18), rgba(143, 115, 255, 0.10)) border-box;
	box-shadow: 0 4px 14px rgba(79, 140, 255, 0.22);
}

.group-chip .icon {
	width: 22px;
	height: 22px;
	border-radius: 6px;
	flex: 0 0 22px;
	display: grid;
	place-items: center;
	font-size: 12px;
	font-weight: 700;
	color: #cfe2ff;
	background: radial-gradient(120% 120% at 30% 20%, rgba(99, 120, 220, 0.55), rgba(35, 45, 95, 0.45) 60%, rgba(20, 26, 60, 0.35) 100%);
	border: 1px solid var(--chip-on);
}

.group-chip .label {
	flex: 1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	font-weight: 700;
}

.group-chip .badge {
	font-size: 11px;
	color: var(--muted);
	padding: 3px 8px;
	border-radius: 999px;
	border: 1px solid #1c2247;
	background: #0c1130;
	font-variant-numeric: tabular-nums;
}

.group-chip[data-adult="true"] {
	border-color: #4b1e33;
	background: linear-gradient(180deg, rgba(199, 59, 111, 0.16), rgba(48, 17, 38, 0.12)) border-box;
}

.group-chip[data-adult="true"] .icon {
	color: #ffd0df;
	background: radial-gradient(120% 120% at 30% 20%, rgba(255, 122, 166, 0.55), rgba(75, 30, 51, 0.45) 60%, rgba(40, 12, 26, 0.35) 100%);
	border-color: #4b1e33;
}

/* =================== ОСНОВНАЯ ОБЛАСТЬ =================== */
.main {
	grid-area: main;
	display: grid;
	grid-template-columns: 520px 1fr;
	gap: 0;
	height: 100%;
	overflow: hidden;
}

/* =================== КАНАЛЫ =================== */
.channels {
	border-right: 1px solid var(--line);
	background: var(--bg);
	display: flex;
	flex-direction: column;
	min-width: 400px;
	overflow: hidden;
}

.channels .header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border-bottom: 1px solid var(--line);
}

.view-switch {
	margin-left: auto;
	display: flex;
	gap: 6px;
}

.view-switch button {
	padding: 6px 8px;
	border: 1px solid var(--line);
	background: var(--chip);
	border-radius: 8px;
	color: var(--muted);
	cursor: pointer;
	transition: all 0.2s ease;
}

.view-switch button.active {
	background: var(--chip-on);
	color: var(--text);
}

#channels {
	flex: 1;
}

/* Списки каналов */
.list {
	display: grid;
	grid-template-columns: 1fr;
	gap: 6px;
	padding: 8px;
}

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

.list.scrollable,
.grid.scrollable,
.scrollable {
	overflow-y: auto;
	overflow-x: hidden;
	scrollbar-width: thin;
	scrollbar-color: var(--line) transparent;
	-webkit-overflow-scrolling: touch;
	scroll-behavior: smooth;
}

.scrollable::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}

.scrollable::-webkit-scrollbar-track {
	background: transparent;
}

.scrollable::-webkit-scrollbar-thumb {
	background: #3b4678;
	border-radius: 8px;
	border: 2px solid var(--bg);
}

.scrollable::-webkit-scrollbar-thumb:hover {
	background: var(--muted);
}

/* Карточки каналов */
.card {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.2s ease;
	position: relative;
}

.card:hover {
	transform: translateY(-2px);
	border-color: var(--brand);
	box-shadow: 0 4px 12px rgba(79, 140, 255, 0.1);
}

.card.active {
	background: linear-gradient(135deg, rgba(79, 140, 255, 0.15), rgba(143, 115, 255, 0.1));
	border-color: var(--brand);
	box-shadow: 0 4px 16px rgba(79, 140, 255, 0.2);
	transform: translateY(-1px);
}

.card.active::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 4px;
	background: var(--brand);
	border-radius: 2px;
}

.logo {
	width: 32px;
	height: 32px;
	border-radius: 6px;
	background: #0d1230;
	object-fit: contain;
	border: 1px solid #1b2250;
}

.cmeta {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1;
	padding-right: 32px;
}

.cmeta .name {
	font-weight: 700;
	font-size: 13px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: var(--text);
}

.cmeta .group {
	font-size: 11px;
	color: var(--muted);
	margin-bottom: 2px;
}

.playing-indicator {
	font-size: 10px;
	color: var(--brand);
	font-weight: 600;
	padding: 1px 4px;
	background: rgba(79, 140, 255, 0.1);
	border-radius: 3px;
	border: 1px solid rgba(79, 140, 255, 0.2);
	display: inline-block;
	animation: pulse 2s infinite;
}

.archive-indicator {
	font-size: 11px;
	color: var(--warn);
	font-weight: 600;
	padding: 1px 4px;
	background: rgba(255, 207, 102, 0.1);
	border-radius: 3px;
	border: 1px solid rgba(255, 207, 102, 0.2);
	display: inline-block;
	margin-top: 2px;
	transition: all 0.2s ease;
}

.archive-indicator:hover {
	background: rgba(255, 207, 102, 0.2);
	border-color: rgba(255, 207, 102, 0.4);
	transform: scale(1.05);
}

@keyframes pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.7; }
}

.cactions {
	margin-left: auto;
	display: flex;
	align-items: flex-start;
	gap: 6px;
	padding-top: 1px;
	flex-shrink: 0;
	position: absolute;
	top: 6px;
	right: 6px;
}

.star {
	width: 20px;
	height: 20px;
	border-radius: 4px;
	border: 1px solid var(--line);
	display: grid;
	place-items: center;
	color: #c2c8e8;
	font-size: 12px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.star:hover {
	background: rgba(194, 200, 232, 0.1);
	border-color: #4a5a8a;
	transform: scale(1.05);
}

.star.active {
	background: #ffd56a1a;
	color: #ffd56a;
	border-color: #3c2f16;
}

.star.active:hover {
	background: #ffd56a2a;
	transform: scale(1.05);
}

.lock {
	width: 22px;
	height: 22px;
	border-radius: 6px;
	border: 1px solid var(--line);
	display: grid;
	place-items: center;
}

.lock.adult {
	color: var(--danger);
	border-color: #4b1e33;
	background: #301126;
}

/* =================== ПЛЕЕР =================== */
.viewer {
	display: grid;
	grid-template-rows: 70px minmax(280px, 50vh) auto 1fr;
	overflow: hidden;
	background: linear-gradient(180deg, var(--bg-soft), var(--bg));
}

.viewer .toolbar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 20px;
	border-bottom: 1px solid var(--line);
	background: linear-gradient(180deg, var(--card), var(--card-2));
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tag {
	padding: 8px 14px;
	border-radius: 12px;
	background: var(--chip);
	color: var(--text);
	border: 1px solid var(--line);
	font-size: 13px;
	font-weight: 600;
	transition: all 0.2s ease;
}

.tag.live {
	background: linear-gradient(135deg, #142346, #1a2b5a);
	color: #8eb5ff;
	border-color: #2a4b7a;
	box-shadow: 0 2px 8px rgba(142, 181, 255, 0.2);
}

.tag.now {
	background: linear-gradient(135deg, #152b1e, #1e3a2a);
	color: var(--ok);
	border-color: #234e3b;
	box-shadow: 0 2px 8px rgba(123, 226, 180, 0.2);
}

.tag.dvr {
	background: linear-gradient(135deg, #2b1f0f, #3a2a1a);
	color: var(--warn);
	border-color: #463015;
	box-shadow: 0 2px 8px rgba(255, 207, 102, 0.2);
}

.tag.archive {
	background: linear-gradient(135deg, #1f2b0f, #2a3a1a);
	color: var(--ok);
	border-color: #234e3b;
	box-shadow: 0 2px 8px rgba(123, 226, 180, 0.2);
}

.player {
	background: linear-gradient(135deg, #000, #0a0a0a);
	display: grid;
	place-items: center;
	border-bottom: 1px solid var(--line);
	position: relative;
	overflow: hidden;
}

.player::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: radial-gradient(circle at center, rgba(79, 140, 255, 0.1) 0%, transparent 70%);
	pointer-events: none;
}

.player video {
	width: 100%;
	height: 100%;
	max-height: 50vh;
	background: #000;
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* DVR панель управления */
.dvrbar {
	display: flex;
	gap: 10px;
	align-items: center;
	padding: 16px 20px;
	border-bottom: 1px solid var(--line);
	background: linear-gradient(180deg, var(--card-2), var(--bg-soft));
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.dvrbar .btn {
	padding: 10px 16px;
	border-radius: 10px;
	background: var(--chip);
	border: 1px solid var(--line);
	color: var(--text);
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	font-size: 13px;
}

.dvrbar .btn:hover {
	background: var(--chip-on);
	border-color: var(--brand);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(79, 140, 255, 0.2);
}

.dvrbar .hint {
	color: var(--muted);
	margin-left: auto;
	font-size: 13px;
	font-weight: 500;
	padding: 8px 12px;
	background: var(--bg-soft);
	border-radius: 8px;
	border: 1px solid var(--line);
}

.dvrbar input[type=datetime-local] {
	background: var(--card-2);
	border: 1px solid var(--line);
	color: var(--text);
	padding: 10px 12px;
	border-radius: 10px;
	font-size: 13px;
	transition: all 0.2s ease;
}

.dvrbar input[type=datetime-local]:focus {
	border-color: var(--brand);
	box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.2);
	outline: none;
}

/* =================== EPG (Программа передач) =================== */
.epg {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--bg);
}

.epg .nav {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	border-bottom: 1px solid var(--line);
}

.nav button {
	padding: 8px 10px;
	border: 1px solid var(--line);
	background: var(--chip);
	border-radius: 8px;
	color: var(--muted);
	cursor: pointer;
	transition: all 0.2s ease;
}

.nav button:hover {
	background: var(--chip-on);
	color: var(--text);
}

.nav .date {
	margin-left: auto;
	color: var(--text);
	font-weight: 700;
}

.epg-list {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 8px 10px;
	overflow: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.epg-list::-webkit-scrollbar {
	display: none;
}

.epg-item {
	display: grid;
	grid-template-columns: 120px 1fr 210px;
	gap: 12px;
	align-items: center;
	background: var(--card);
	border: 1px solid var(--line);
	padding: 10px 12px;
	border-radius: 12px;
	transition: all 0.2s ease;
}

.epg-item.now {
	border-color: #2a5f4a;
	background: #122224;
}

.epg-item.watching {
	border-color: #4a5f2a;
	background: #222412;
	box-shadow: 0 0 0 2px rgba(74, 95, 42, 0.3);
}

.epg-item .t {
	font-weight: 700;
}

.epg-item .title {
	font-weight: 700;
}

.epg-item .hint {
	color: var(--muted);
	font-size: 12px;
}

.epg-item .archive-hint {
	color: var(--warn);
	font-size: 12px;
	margin-top: 4px;
	opacity: 0.8;
}

/* =================== КНОПКИ =================== */
.btn {
	padding: 10px 18px;
	border: 1px solid var(--line);
	background: linear-gradient(135deg, var(--chip), var(--card-2));
	color: var(--text);
	border-radius: 10px;
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	transition: all 0.2s ease;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:hover {
	background: linear-gradient(135deg, var(--chip-on), var(--card));
	border-color: var(--brand);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(79, 140, 255, 0.2);
}

.btn:active {
	transform: translateY(0);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

.btn.danger {
	background: #2a1420;
	border-color: #4b2236;
	color: #ff97b5;
}

.btn.ok {
	background: #15291f;
	border-color: #234e3b;
	color: var(--ok);
}

.btn.warn {
	background: #2a2415;
	border-color: #45381b;
	color: var(--warn);
}

/* =================== ВСПОМОГАТЕЛЬНЫЕ ЭЛЕМЕНТЫ =================== */
.kbd {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 12px;
	padding: 2px 6px;
	border: 1px solid #1f223a;
	border-radius: 6px;
	color: var(--muted);
}

/* =================== НАСТРОЙКИ =================== */
.settings {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	padding: 16px;
}

.card-set {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 14px;
}

.card-set h3 {
	margin: 0 0 10px 0;
}

.row {
	display: flex;
	gap: 8px;
	align-items: center;
	margin: 6px 0;
}

.row input[type=text],
.row input[type=password],
.row input[type=number] {
	flex: 1;
	background: var(--card-2);
	border: 1px solid var(--line);
	color: var(--text);
	padding: 10px;
	border-radius: 10px;
}

small.muted {
	color: var(--muted);
}

hr.sep {
	border: 0;
	border-top: 1px solid var(--line);
	margin: 10px 0;
}

/* =================== МОДАЛЬНЫЕ ОКНА =================== */
.modal {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 200;
}

.modal .panel {
	width: min(520px, 92vw);
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 16px;
}

.modal .head {
	font-weight: 800;
	font-size: 18px;
	margin-bottom: 8px;
}

.modal .actions {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	margin-top: 12px;
}

/* =================== ПРИВЕТСТВЕННЫЙ ЭКРАН =================== */
.welcome-overlay {
	position: fixed;
	inset: 0;
	background: linear-gradient(135deg, var(--bg) 0%, #1a1f2e 50%, #0f1428 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10000;
	backdrop-filter: blur(10px);
}

.welcome-card {
	background: linear-gradient(135deg, var(--card), var(--card-2));
	border: 1px solid var(--line);
	border-radius: 20px;
	padding: 40px;
	max-width: 500px;
	width: 90vw;
	text-align: center;
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
	position: relative;
	overflow: hidden;
}

.welcome-card::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 4px;
	background: linear-gradient(90deg, var(--brand), #8f73ff);
}

.welcome-logo {
	width: 80px;
	height: 80px;
	background: linear-gradient(135deg, var(--brand), #8f73ff);
	border-radius: 20px;
	margin: 0 auto 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 32px;
	color: white;
	box-shadow: 0 8px 24px rgba(79, 140, 255, 0.3);
}

.welcome-title {
	font-size: 28px;
	font-weight: 800;
	color: var(--text);
	margin-bottom: 12px;
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.welcome-subtitle {
	color: var(--muted);
	font-size: 16px;
	margin-bottom: 32px;
	line-height: 1.5;
}

.welcome-form {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.welcome-input {
	background: var(--bg-soft);
	border: 2px solid var(--line);
	border-radius: 12px;
	padding: 16px 20px;
	color: var(--text);
	font-size: 16px;
	transition: all 0.3s ease;
	outline: none;
}

.welcome-input:focus {
	border-color: var(--brand);
	box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.1);
}

.welcome-input::placeholder {
	color: var(--muted);
}

.welcome-btn {
	background: linear-gradient(135deg, var(--brand), #8f73ff);
	border: none;
	color: white;
	padding: 16px 32px;
	border-radius: 12px;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: 0 4px 16px rgba(79, 140, 255, 0.3);
}

.welcome-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 24px rgba(79, 140, 255, 0.4);
}

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

.welcome-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

.welcome-help {
	margin-top: 24px;
	padding: 16px;
	background: var(--bg-soft);
	border-radius: 12px;
	border: 1px solid var(--line);
}

.welcome-help h4 {
	color: var(--text);
	margin: 0 0 8px 0;
	font-size: 14px;
	font-weight: 600;
}

.welcome-help p {
	color: var(--muted);
	margin: 0;
	font-size: 13px;
	line-height: 1.4;
}

/* =================== TOAST УВЕДОМЛЕНИЯ =================== */
.toast {
	position: fixed;
	left: 50%;
	bottom: 16px;
	transform: translateX(-50%);
	background: #1b223f;
	border: 1px solid #2a3563;
	color: var(--text);
	padding: 10px 14px;
	border-radius: 10px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
	z-index: 9999;
	display: none;
	max-width: 90vw;
	font-size: 13px;
}

.toast.show {
	display: block;
}

/* =================== ВИДЕОТЕКА =================== */
.movies-container {
	padding: 16px;
	height: calc(100vh - 200px);
	overflow-y: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.movies-container::-webkit-scrollbar {
	display: none;
}

.search-movies {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 8px 12px;
}

.search-movies span {
	color: var(--muted);
	font-size: 14px;
}

.search-movies input {
	background: none;
	border: none;
	color: var(--text);
	outline: none;
	width: 200px;
	font-size: 14px;
}

.search-movies input::placeholder {
	color: var(--muted);
}

.year-filter {
	display: flex;
	align-items: center;
	gap: 8px;
}

.year-filter select {
	min-width: 120px;
}

.movies-list {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

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

.year-title {
	color: var(--text);
	font-size: 18px;
	font-weight: 700;
	margin: 0 0 16px 0;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--line);
}

.movies-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 16px;
}

.movie-card {
	background: linear-gradient(135deg, var(--card), var(--card-2));
	border: 1px solid var(--line);
	border-radius: 16px;
	overflow: hidden;
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.movie-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
	border-color: var(--brand);
}

.movie-poster {
	position: relative;
	width: 100%;
	height: 280px;
	overflow: hidden;
	border-radius: 12px 12px 0 0;
}

.movie-poster img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.movie-card:hover .movie-poster img {
	transform: scale(1.08);
}

.movie-info {
	padding: 16px;
	background: linear-gradient(180deg, var(--card), var(--card-2));
}

.movie-title {
	font-weight: 700;
	color: var(--text);
	margin-bottom: 8px;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 15px;
}

.movie-year {
	color: var(--brand);
	font-size: 13px;
	font-weight: 600;
	padding: 4px 8px;
	background: rgba(79, 140, 255, 0.1);
	border-radius: 6px;
	display: inline-block;
}

.loading,
.error,
.no-movies {
	text-align: center;
	padding: 40px;
	color: var(--muted);
	font-size: 14px;
}

.error {
	color: var(--warn);
}

/* Модальное окно фильма */
.movie-modal .panel {
	width: min(1400px, 98vw);
	max-height: 95vh;
	overflow-y: auto;
	background: linear-gradient(135deg, var(--card), var(--card-2));
	border: 1px solid var(--line);
	border-radius: 16px;
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(10px);
}

.movie-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
	padding: 20px 24px 16px;
	border-bottom: 1px solid var(--line);
	background: linear-gradient(180deg, rgba(79, 140, 255, 0.1), transparent);
}

.movie-modal-title {
	font-size: 28px;
	font-weight: 800;
	color: var(--text);
	margin: 0;
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.movie-modal-header .btn {
	background: var(--danger);
	border: none;
	color: white;
	padding: 8px 12px;
	border-radius: 8px;
	font-size: 16px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.movie-modal-header .btn:hover {
	background: #ff5a8a;
	transform: scale(1.05);
}

.movie-modal-content {
	display: grid;
	grid-template-columns: 2.5fr 1fr;
	gap: 32px;
	align-items: start;
	padding: 0 24px 24px;
}

.movie-modal-player {
	width: 100%;
	height: 500px;
	background: #000;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
	position: relative;
}

.movie-modal-player video {
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #000;
}

.movie-modal-info {
	display: flex;
	flex-direction: column;
	gap: 20px;
	position: sticky;
	top: 20px;
}

.movie-modal-poster {
	width: 100%;
	height: 280px;
	overflow: hidden;
	border-radius: 16px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
	position: relative;
}

.movie-modal-poster img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	transition: transform 0.3s ease;
	background: var(--bg-soft);
}

.movie-modal-poster:hover img {
	transform: scale(1.05);
}

.movie-modal-details {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 20px;
	background: var(--card-2);
	border-radius: 12px;
	border: 1px solid var(--line);
}

.movie-modal-year {
	color: var(--brand);
	font-size: 18px;
	font-weight: 700;
	padding: 8px 16px;
	background: rgba(79, 140, 255, 0.1);
	border-radius: 8px;
	text-align: center;
}

.movie-modal-description {
	color: var(--text);
	line-height: 1.7;
	font-size: 15px;
	max-height: 200px;
	overflow-y: auto;
	padding: 12px;
	background: var(--bg-soft);
	border-radius: 8px;
	border: 1px solid var(--line);
}

.movie-modal-description::-webkit-scrollbar {
	width: 6px;
}

.movie-modal-description::-webkit-scrollbar-thumb {
	background: var(--line);
	border-radius: 3px;
}

/* =================== СТРАНИЦА ПОМОЩИ =================== */
.help-content {
	padding: 20px;
	max-width: 1200px;
	margin: 0 auto;
}

.help-section {
	margin-bottom: 40px;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 16px;
	padding: 24px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.help-section h2 {
	color: var(--brand);
	font-size: 28px;
	font-weight: 800;
	margin: 0 0 16px 0;
	text-align: center;
}

.help-section h3 {
	color: var(--text);
	font-size: 22px;
	font-weight: 700;
	margin: 0 0 20px 0;
	padding-bottom: 12px;
	border-bottom: 2px solid var(--line);
}

.help-section h4 {
	color: var(--text);
	font-size: 18px;
	font-weight: 600;
	margin: 0 0 12px 0;
}

.help-section p {
	color: var(--muted);
	line-height: 1.6;
	margin: 0 0 16px 0;
}

.help-step {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	margin-bottom: 20px;
	padding: 16px;
	background: var(--card-2);
	border-radius: 12px;
	border: 1px solid var(--line);
}

.step-number {
	width: 32px;
	height: 32px;
	background: linear-gradient(135deg, var(--brand), #8f73ff);
	color: white;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 16px;
	flex-shrink: 0;
}

.step-content h4 {
	margin: 0 0 8px 0;
	color: var(--text);
}

.step-content p {
	margin: 0;
	color: var(--muted);
}

.help-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 20px;
	margin-top: 20px;
}

.help-card {
	background: var(--card-2);
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 20px;
	text-align: center;
	transition: all 0.3s ease;
}

.help-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
	border-color: var(--brand);
}

.help-icon {
	font-size: 48px;
	margin-bottom: 16px;
	display: block;
}

.help-card h4 {
	color: var(--text);
	font-size: 18px;
	font-weight: 600;
	margin: 0 0 12px 0;
}

.help-card p {
	color: var(--muted);
	line-height: 1.5;
	margin: 0;
}

.help-feature {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	margin-bottom: 24px;
	padding: 20px;
	background: var(--card-2);
	border-radius: 12px;
	border: 1px solid var(--line);
}

.feature-icon {
	font-size: 32px;
	flex-shrink: 0;
	margin-top: 4px;
}

.feature-content h4 {
	margin: 0 0 12px 0;
	color: var(--text);
}

.feature-content p {
	margin: 0 0 12px 0;
	color: var(--muted);
}

.feature-content ul {
	margin: 0;
	padding-left: 20px;
	color: var(--muted);
}

.feature-content li {
	margin-bottom: 8px;
	line-height: 1.5;
}

.archive-badge {
	background: rgba(255, 207, 102, 0.1);
	color: var(--warn);
	padding: 2px 6px;
	border-radius: 4px;
	border: 1px solid rgba(255, 207, 102, 0.2);
	font-weight: 600;
}

.warning-box {
	background: linear-gradient(135deg, #2a1420, #3a1f2a);
	border: 1px solid #4b2236;
	color: #ff97b5;
	padding: 16px;
	border-radius: 12px;
	margin: 16px 0;
	font-weight: 600;
}

.tip-box {
	background: linear-gradient(135deg, #15291f, #1e3a2a);
	border: 1px solid #234e3b;
	color: var(--ok);
	padding: 16px;
	border-radius: 12px;
	margin: 16px 0;
	font-weight: 600;
}

.faq-item {
	margin-bottom: 24px;
	padding: 20px;
	background: var(--card-2);
	border-radius: 12px;
	border: 1px solid var(--line);
}

.faq-item h4 {
	color: var(--brand);
	margin: 0 0 12px 0;
	font-size: 16px;
	font-weight: 600;
}

.faq-item p {
	margin: 0;
	color: var(--muted);
	line-height: 1.6;
}

/* =================== АДАПТИВНОСТЬ БЕЗ ДУБЛЕЙ =================== */

/* Планшеты (1200px и меньше) */
@media (max-width: 1200px) {
	.container {
		grid-template-columns: 240px 1fr;
	}
	
	.side {
		width: 240px;
		max-width: 240px;
	}
	
	.main {
		grid-template-columns: 400px 1fr;
	}
	
	.viewer {
		min-height: 400px;
	}
	
	.player video {
		max-height: 60vh;
	}
	
	.help-content {
		padding: 20px;
		max-height: calc(100vh - 200px);
		overflow-y: auto;
	}
	
	.help-section {
		margin-bottom: 24px;
	}
}

/* Средние планшеты (1000px и меньше) */
@media (max-width: 1000px) {
	.container {
		grid-template-columns: 200px 1fr;
	}
	
	.side {
		width: 200px;
		max-width: 200px;
	}
	
	.main {
		grid-template-columns: 350px 1fr;
	}
	
	.group-chip {
		padding: 6px 8px;
		font-size: 12px;
	}
	
	.group-chip .icon {
		width: 18px;
		height: 18px;
		flex: 0 0 18px;
		font-size: 10px;
	}
	
	.group-chip .label {
		font-size: 12px;
	}
}

/* Средние экраны (800px и меньше) */
@media (max-width: 800px) {
	.container {
		grid-template-columns: 1fr;
		grid-template-areas: 
			"top"
			"main";
	}
	
	.menu-toggle {
		display: flex;
		order: -1;
	}
	
	.side {
		position: fixed;
		left: -280px;
		top: 56px;
		width: 280px;
		height: calc(100vh - 56px);
		z-index: 1000;
		transition: left 0.3s ease;
		box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
	}
	
	.side.open {
		left: 0;
	}
	
	.main {
		grid-template-columns: 1fr;
	}
	
	.channels {
		min-width: unset;
	}
	
	.settings {
		grid-template-columns: 1fr;
		padding: 16px;
	}
	
	.movies-grid {
		grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	}
	
	.toolbar,
	.dvrbar,
	.epg .nav {
		flex-wrap: wrap;
		gap: 8px;
		padding: 12px;
	}
	
	.help-content {
		padding: 16px;
		max-height: calc(100vh - 180px);
	}
	
	.help-feature {
		flex-direction: column;
		text-align: center;
	}
	
	.help-step {
		flex-direction: column;
		text-align: center;
	}
}

/* Мобильные устройства (768px и меньше) */
@media (max-width: 768px) {
	.top {
		padding: 12px 16px;
		flex-wrap: wrap;
		gap: 12px;
	}
	
	.tabs {
		order: 3;
		width: 100%;
		justify-content: center;
	}
	
	.search {
		order: 2;
		flex: 1;
		min-width: 200px;
	}
	
	/* Улучшение касаний и доступности */
	.card,
	.tab,
	.btn,
	.group-chip {
		min-height: 44px;
		touch-action: manipulation;
	}
	
	.card:focus,
	.tab:focus,
	.btn:focus,
	.group-chip:focus {
		outline: 2px solid var(--brand);
		outline-offset: 2px;
	}
	
	.channels .header {
		flex-wrap: wrap;
		padding: 12px;
	}
	
	.view-switch {
		order: 3;
		width: 100%;
		justify-content: center;
	}
	
	.grid {
		grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	}
	
	.movies-grid {
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	}
	
	.player video {
		max-height: 50vh;
	}
	
	.epg-item {
		padding: 12px;
		min-height: 60px;
	}
	
	.modal .panel {
		width: 95vw;
		max-height: 90vh;
	}
	
	.movie-modal-content {
		grid-template-columns: 1fr;
		gap: 24px;
	}
}

/* Маленькие мобильные устройства (480px и меньше) */
@media (max-width: 480px) {
	.top {
		padding: 8px 12px;
	}
	
	.search {
		min-width: 150px;
	}
	
	.grid {
		grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
	}
	
	.movies-grid {
		grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
	}
	
	.player video {
		max-height: 40vh;
	}
	
	.movie-modal .panel {
		width: 98vw;
		max-height: 98vh;
		margin: 10px;
	}
}

/* Очень маленькие экраны (360px и меньше) */
@media (max-width: 360px) {
	.top {
		padding: 8px;
	}
	
	.search {
		min-width: 120px;
	}
}
