:root {
	/* Канал текста: один источник для всех rgba(var(--txt-rgb), α).
	   Читалка только тёмная — выбор темы снят по решению заказчика. */
	--txt-rgb: 235, 235, 245;
	--body-bg: #000000;
	--body-color: #f2f2f7;
	--header-bg: rgba(30, 30, 30, 0.72);
	--header-link-hover: rgba(255,255,255,0.08);
	--header-link-color: rgba(var(--txt-rgb), 0.87);
	--link-color-hover: #fff;
	--readed-active-color: #30D158;
	--readed-active-bg: rgba(48, 209, 88, 0.15);
	--bookmark-active-color: #FF9F0A;
	--bookmark-active-bg: rgba(255, 159, 10, 0.15);
	--img-bg: #000;
	--reader-item-page-color: rgba(var(--txt-rgb), 0.6);
	--nav-bg: rgba(44, 44, 46, 0.72);
	--nav-button-color: #f2f2f7;
	--nav-button-hover: rgba(255,255,255,0.12);
	--footer-bg: rgba(28, 28, 30, 0.9);
	--footer__nav-color: rgba(var(--txt-rgb), 0.3);
	--popup-bg: rgba(28, 28, 30, 0.85);
	--chapters__item-color-hover: #fff;
	--chapters__item-bg-hover: rgba(255, 163, 50, 0.18);
	--menu__item-bg: transparent;
	--menu__item-border: rgba(84, 84, 88, 0.65);
	--menu__item-color: rgba(var(--txt-rgb), 0.87);
	--menu__item-color-hover: #fff;
	--settings__row-bg: rgba(118, 118, 128, 0.24);
	--settings__row-item-color: rgba(var(--txt-rgb), 0.6);
	--settings__row-item-color-hover: #fff;
	--settings__row-item-bg-active: #ffa332;
	--scrollbar-track: rgba(0,0,0,0);
	--scrollbar-thumb: rgba(255,255,255,0.25);
	/* iOS 17 system tokens */
	--ios-blue: #ffa332;
	--ios-green: #30D158;
	--ios-separator: rgba(84, 84, 88, 0.65);
	--ios-radius-l: 16px;
	--ios-radius-m: 12px;
	--ios-radius-s: 10px;
}



/* Webtoon: «Разворот» неприменим к длинной полосе — гасим кнопку режима */
body[data-webtoon] .settings-tablet-item {
	opacity: .35;
	pointer-events: none;
}

body {
	margin: 0;
	background: var(--body-bg);
	color: var(--body-color);
	font-size: 13px;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	font-weight: bold;
}
*, *:after, *:before {
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	box-sizing: border-box;
}
ul {
	list-style: none;
	margin: 0;
	padding: 0;
}
h1,h2,h3,h4,h5 {
	margin: 0;
	padding: 0;
	font-weight: 500;
}
a {
	text-decoration: none;
	color: var(--header-link-color);
	transition: .2s;
}
a:hover {
	color: var(--link-color-hover);
}
input, select, button {
	font-family: inherit;
	outline: none;
}

body[data-blocked] {
	cursor: default;
	overflow: hidden;
	padding-right: 12px;
}

.text-truncate {
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow: hidden;
}

.hidden, [hidden], [v-cloak] {display: none}

.wrapper {
	max-width: 1200px;
	margin: 0 auto;
}

/* ── Header: Apple iOS 17-style navigation bar (3-column CSS Grid) ─────────── */
.header {
	background: var(--header-bg);
	backdrop-filter: blur(12px) saturate(160%);
	-webkit-backdrop-filter: blur(12px) saturate(160%);
	border-bottom: 0.5px solid var(--ios-separator);
	height: 54px;
	/* 3-column grid: [back+title] [chapter selector] [actions] */
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	z-index: 100;
	/* Шапка залипает СПРЯТАННОЙ над экраном и выезжает при скролле вверх.
	   Раньше было position:relative — она уезжала навсегда, из-за чего
	   действия (Read/Bookmark/Settings/ToC) становились недоступны. */
	position: -webkit-sticky;
	position: sticky;
	top: -54px;
	transition: top 0.3s cubic-bezier(.4,0,.2,1);
}
.header.visible {
	top: 0;
}
/* legacy: класс больше не ставится, оставлен для внешних стилей */
.header--hidden {
	transform: translateY(-100%);
}
.header.fixed {
	position: sticky;
	top: 0;
	left: 0;
	right: 0;
}

/* ── Back button + comic title (column 1) ───────────────────────────────────── */
.header__post-link {
	display: flex;
	align-items: center;
	gap: 2px;
	padding: 0 8px 0 12px;
	min-width: 0;
	height: 54px;
	margin-right: 12px;        /* gap between hover bg and chapter__selector */
	border-radius: var(--ios-radius-s);
	transition: background 0.15s;
}
.header__post-link:hover {
	background: var(--header-link-hover);
}
.header__back-icon {
	color: var(--ios-blue);
	font-size: 17px;
	flex-shrink: 0;
	margin-right: 2px;
}
.header__post-title {
	font-size: 14px;
	font-weight: 500;
	color: rgba(var(--txt-rgb), 0.87);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ── Chapter selector pill (column 2, true-centered) ───────────────────────── */
.chapter__selector {
	display: flex;
	align-items: center;
	background: rgba(118, 118, 128, 0.18);
	border-radius: var(--ios-radius-s);
	padding: 0 2px;
	margin: 8px 0;
	transition: background 0.15s;
}
.chapter__selector:hover {
	background: rgba(118, 118, 128, 0.26);
}
	.chapter__selector-icon {
		width: 32px;
		height: 38px;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 8px;
		color: var(--ios-blue);
		transition: background 0.15s;
	}
	.chapter__selector-icon:hover {
		background: rgba(255, 255, 255, 0.1);
	}
	.chapter__selector-icon.disabled {
		opacity: .3;
		pointer-events: none;
		color: var(--body-color);
	}
	.chapter__selector-trigger {
		padding: 4px 6px;
		text-align: center;
		min-width: 130px;
		max-width: 220px;
	}
		.chapter__selector-trigger__label {
			font-size: 10px;
			font-weight: 500;
			color: rgba(var(--txt-rgb), 0.4);
			letter-spacing: 0.06em;
			text-transform: uppercase;
			line-height: 1.3;
		}
		.chapter__selector-trigger__title {
			font-size: 13px;
			font-weight: 600;
			line-height: 1.3;
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
		}

/* ── Action buttons (column 3, right-aligned) ───────────────────────────────── */
.actions {
	display: flex;
	justify-content: flex-end;
	font-size: 16px;
}
	.action__item {
		padding: 0 10px;
		height: 54px;
		min-width: 44px;
		display: flex;
		justify-content: center;
		align-items: center;
		border-radius: var(--ios-radius-s);
		transition: background 0.2s, transform 0.15s;
		color: rgba(var(--txt-rgb), 0.87);
	}
	.action__item:hover {
		background: var(--header-link-hover);
	}
	.action__item:active {
		transform: scale(0.92);
		opacity: 0.7;
	}
		.action__item-label {
			font-size: 13px;
			font-weight: 500;
			margin-left: 6px;
		}
	.readed.active {
		color: var(--readed-active-color);
		background: var(--readed-active-bg);
	}
	.bookmark.active {
		color: var(--bookmark-active-color);
		background: var(--bookmark-active-bg);
	}
	.bookmark.fixed {
		position: fixed;
		top: 0;
		right: 5px;
		background: var(--header-bg);
		backdrop-filter: blur(12px) saturate(160%);
		-webkit-backdrop-filter: blur(12px) saturate(160%);
		border-radius: 0 0 var(--ios-radius-s) var(--ios-radius-s);
	}

.reader-view {
	margin: 0 auto;
	max-width: 100%;
	max-height: 100%;
}
	.reader__item-wrap {
		display: none;
		/* Шапка sticky (top:-54px → 0 при .visible), поэтому scrollIntoView
		   в вертикальном режиме прижимал верх страницы вплотную к ней и она
		   перекрывала картинку. Нативный запас в высоту шапки. */
		scroll-margin-top: 54px;
	}
	.reader__item-wrap.active {
		display: block;
	}
		.reader__item-page {
			text-align: center;
			padding-top: 5px;
			font-size: 16px;
			line-height: 35px;
			font-weight: 500;
			color: var(--reader-item-page-color);
		}
		.reader__item {
			display: block;
			cursor: pointer;
			background: var(--img-bg) url('../img/loading.gif') no-repeat 50% 50%;
			margin: 0 auto;
			max-width: 100%;
			min-width: 300px;
			min-height: 300px;
			box-shadow: 0 4px 14px rgba(0,0,0,.1);
			/* smooth double-tap zoom */
			transition: transform 0.3s ease;
			transform-origin: 50% 50%;
		}
		/* Fit Height mode: image width is computed from viewport height,
		   suppress min-width so narrow viewports can shrink the page. */
		.reader-view.fit-height .reader__item {
			min-width: 0;
		}
		.reader__item-wrap {
			overflow: visible;
		}


.chapter__selector-footer {
	display: flex;
	justify-content: space-between;
	padding: 10px 15px 0;
	max-width: 400px;
	margin: 0 auto;
}
	.chapter__selector-footer__item {
		line-height: 38px;
		color: inherit;
		background: var(--nav-bg);
		backdrop-filter: blur(12px) saturate(160%);
		-webkit-backdrop-filter: blur(12px) saturate(160%);
		border: 0.5px solid var(--ios-separator);
		padding: 0 25px;
		border-radius: var(--ios-radius-m);
		transition: background 0.2s, transform 0.15s;
	}
	.chapter__selector-footer__item:hover {
		background: var(--nav-button-hover);
	}
	.chapter__selector-footer__item:active {
		transform: scale(0.95);
		opacity: 0.8;
	}
		.chapter__selector-footer__item i.fa {
			font-size: .85em;
		}


.nav {
	position: -webkit-sticky;
	position: sticky;
	bottom: 0;
	display: flex;
	padding: 10px 15px;
	z-index: 50;
	transition: transform 0.3s ease, opacity 0.3s ease;
}

/* In fullscreen: slide nav down out of view */
:fullscreen .nav,
:-webkit-full-screen .nav {
	transform: translateY(110%);
	opacity: 0;
	pointer-events: none;
}
	.nav__pages {
		position: relative;
		padding: 0 14px;
		line-height: 38px;
		background: var(--nav-bg);
		backdrop-filter: blur(12px) saturate(160%);
		-webkit-backdrop-filter: blur(12px) saturate(160%);
		border: 0.5px solid var(--ios-separator);
		border-radius: var(--ios-radius-m);
		margin-right: 8px;
	}
		.nav__pages select {
			position: absolute;
			top: 0;
			left: 0;
			height: 100%;
			border: none;
			cursor: pointer;
			opacity: 0;
			width: 100%;
		}
	.nav__paginate {
		background: var(--nav-bg);
		backdrop-filter: blur(12px) saturate(160%);
		-webkit-backdrop-filter: blur(12px) saturate(160%);
		border: 0.5px solid var(--ios-separator);
		border-radius: var(--ios-radius-m);
		display: flex;
		overflow: hidden;
	}
		.nav__paginate-item {
			border: none;
			width: 44px;
			min-height: 38px;
			background: transparent;
			color: var(--nav-button-color);
			cursor: pointer;
			transition: background 0.15s, transform 0.15s;
		}
		.nav__paginate-item:hover {
			background: var(--nav-button-hover);
		}
		.nav__paginate-item:active {
			transform: scale(0.92);
			opacity: 0.7;
		}
		.nav__paginate-item + .nav__paginate-item {
			margin-left: 1px;
		}
		.nav__paginate-item.disabled {
			opacity: .4;
			pointer-events: none;
		}


.footer {
	background: var(--footer-bg);
	backdrop-filter: blur(12px) saturate(160%);
	-webkit-backdrop-filter: blur(12px) saturate(160%);
	border-top: 0.5px solid var(--ios-separator);
	padding: 24px 20px 32px;
}
.footer__nav-links {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 16px;
}
.footer__nav-item {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 0 14px;
	height: 36px;
	border-radius: var(--ios-radius-m);
	background: rgba(118, 118, 128, 0.18);
	font-size: 14px;
	color: rgba(var(--txt-rgb), 0.7);
	transition: background 0.2s, color 0.2s, transform 0.15s;
}
.footer__nav-item:hover {
	background: rgba(118, 118, 128, 0.3);
	color: #fff;
}
.footer__nav-item:active {
	transform: scale(0.95);
}
.footer__actions {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-bottom: 16px;
}
.footer__action-btn {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 0 18px;
	height: 36px;
	border-radius: var(--ios-radius-m);
	background: var(--ios-blue);
	color: #000;
	font-size: 14px;
	font-weight: 500;
	transition: opacity 0.2s, transform 0.15s;
	cursor: pointer;
}
.footer__action-btn:hover {
	opacity: 0.85;
	color: #000;
}
.footer__action-btn:active {
	transform: scale(0.95);
}
#installBtn[style*="inline"] {
	display: flex !important;
}
.footer__legal {
	text-align: center;
	font-size: 12px;
	color: rgba(var(--txt-rgb), 0.25);
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
}
.footer__legal a {
	color: rgba(var(--txt-rgb), 0.25);
}
.footer__legal a:hover {
	color: rgba(var(--txt-rgb), 0.5);
}

.speedbar {
	text-align: center;
	max-width: 1000px;
	padding: 0 20px;
	margin: 12px auto;
	font-size: 12px;
	color: rgba(var(--txt-rgb), 0.35);
	letter-spacing: 0.01em;
}
.speedbar a {
	color: rgba(var(--txt-rgb), 0.35);
}
.speedbar a:hover {
	color: rgba(var(--txt-rgb), 0.6);
}




/* ── Slide-in animations (Apple spring curve) ───────────────────────────────── */
@keyframes slideFromLeft {
	from { transform: translateX(-100%); }
	to   { transform: translateX(0); }
}
@keyframes slideFromRight {
	from { transform: translateX(100%); }
	to   { transform: translateX(0); }
}
@keyframes overlayFadeIn {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.popup, .popup:before {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
}
.popup:before {
	content: "";
	display: block;
	background: rgba(0, 0, 0, 0.45);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	z-index: 1200;
	animation: overlayFadeIn 0.25s ease;
}

/* ── Popup panel ─────────────────────────────────────────────────────────────── */
.popup__content {
	z-index: 1300;
	position: absolute;
	left: 0;
	top: 0;
	height: 100%;
	max-height: 100%;
	width: 100%;
	max-width: 340px;
	overflow-y: auto;
	overflow-x: hidden;
	will-change: transform;
	background: var(--popup-bg);
	backdrop-filter: blur(16px) saturate(180%);
	-webkit-backdrop-filter: blur(16px) saturate(180%);
	border-right: 0.5px solid var(--ios-separator);
	animation: slideFromLeft 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}
.popup__chapters {
	max-width: 420px;
}
.popup__settings {
	max-width: 400px;
}
.popup__content-right {
	right: 0;
	left: auto;
	border-right: none;
	border-left: 0.5px solid var(--ios-separator);
	animation: slideFromRight 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}

/* ── Popup heading: centered title + Done button ─────────────────────────────── */
.popup__heading {
	position: sticky;
	top: 0;
	background: rgba(28, 28, 30, 0.85);
	backdrop-filter: blur(12px) saturate(160%);
	-webkit-backdrop-filter: blur(12px) saturate(160%);
	border-bottom: 0.5px solid var(--ios-separator);
	height: 52px;
	padding: 0 8px 0 16px;
	display: flex;
	align-items: center;
}
	.popup__heading-title {
		position: absolute;
		left: 50%;
		transform: translateX(-50%);
		font-size: 17px;
		font-weight: 600;
		color: var(--body-color);
		max-width: 55%;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		pointer-events: none;
	}
	.popup__close-btn {
		margin-left: auto;
		color: var(--ios-blue) !important;
		font-size: 17px;
		font-weight: 400;
		padding: 6px 10px;
		border-radius: var(--ios-radius-s);
		transition: background 0.15s;
		white-space: nowrap;
		flex-shrink: 0;
	}
	.popup__close-btn:hover {
		background: rgba(255, 163, 50, 0.12);
		color: var(--ios-blue) !important;
	}

.popup__body {
	padding: 0 12px 24px;
}



/* ── Chapters list: iOS UITableView style ───────────────────────────────────── */
.popup__chapters .popup__body {
	padding: 0 0 30px;
}
.chapters__list {
	padding: 8px 0;
}
	.chapters__item {
		display: flex;
		align-items: center;
		padding: 0 16px 0 20px;
		min-height: 44px;
		font-size: 15px;
		font-weight: 400;
		line-height: 1.35;
		color: rgba(var(--txt-rgb), 0.87);
		border-bottom: 0.5px solid rgba(84, 84, 88, 0.3);
		margin-bottom: 0;
		border-radius: 0;
		transition: background 0.12s;
	}
	.chapters__item:last-child {
		border-bottom: none;
	}
	.chapters__item:nth-child(2n) {
		background: transparent;
	}
	.chapters__item:hover {
		background: rgba(255, 255, 255, 0.06);
		color: #fff;
	}
	.chapters__item:active {
		background: rgba(255, 255, 255, 0.1);
	}
	/* Active (current) chapter: accent text + checkmark */
	.chapters__item.active {
		color: var(--ios-blue);
		font-weight: 600;
		background: transparent;
		pointer-events: none;
	}
	.chapters__item.active::after {
		content: "\f00c";
		font-family: FontAwesome;
		font-size: 12px;
		font-weight: 400;
		margin-left: auto;
		padding-left: 12px;
		flex-shrink: 0;
		color: var(--ios-blue);
	}


/* ── Settings panel ──────────────────────────────────────────────────────────── */
.popup__settings .popup__body {
	padding: 0 16px 36px;
}
	.settings__title {
		font-size: 11px;
		font-weight: 600;
		margin-top: 28px;
		margin-bottom: 0;
		text-transform: uppercase;
		letter-spacing: 0.07em;
		color: rgba(var(--txt-rgb), 0.4);
		padding: 0 4px;
	}
	.settings__row {
		display: flex;
		margin-top: 8px;
		padding: 2px;
		border-radius: var(--ios-radius-s);
		background: var(--settings__row-bg);
	}
		.settings__row-item {
			flex: 1;
			line-height: 34px;
			border-radius: 8px;
			text-align: center;
			font-size: 13px;
			font-weight: 500;
			color: var(--settings__row-item-color);
			transition: background 0.2s, color 0.2s, transform 0.15s;
		}
		.settings__row-item:hover {
			color: var(--settings__row-item-color-hover);
		}
		.settings__row-item:active {
			transform: scale(0.95);
		}
		.settings__row-item.active {
			background: var(--settings__row-item-bg-active);
			color: #000;
			font-weight: 600;
			pointer-events: none;
			box-shadow: 0 2px 8px rgba(255, 163, 50, 0.35);
		}
	.settings__row-item.disabled {
		opacity: .4;
		pointer-events: none;
	}
		.settings__row--slider {
			flex-direction: column;
			align-items: stretch;
			padding: 12px 14px;
			gap: 6px;
		}
		.brightness-slider {
			-webkit-appearance: none;
			appearance: none;
			width: 100%;
			height: 4px;
			border-radius: 2px;
			background: rgba(255,255,255,0.15);
			outline: none;
			cursor: pointer;
		}
		.brightness-slider::-webkit-slider-thumb {
			-webkit-appearance: none;
			appearance: none;
			width: 22px;
			height: 22px;
			border-radius: 50%;
			background: #fff;
			box-shadow: 0 1px 6px rgba(0,0,0,0.4);
			cursor: pointer;
			transition: transform 0.15s;
		}
		.brightness-slider::-webkit-slider-thumb:active {
			transform: scale(1.2);
		}
		.brightness-slider::-moz-range-thumb {
			width: 22px;
			height: 22px;
			border-radius: 50%;
			background: #fff;
			border: none;
			box-shadow: 0 1px 6px rgba(0,0,0,0.4);
			cursor: pointer;
		}
		.brightness-value {
			text-align: right;
			font-size: 13px;
			color: var(--settings__row-item-color);
			font-weight: 600;
		}


/* ── Feedback popup: chip-style reason picker + primary submit ──────────────── */
.settings__row--chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 8px;
	background: var(--settings__row-bg);
	border-radius: var(--ios-radius-s);
}
	.settings__row--chips .settings__row-item {
		flex: 0 0 auto;
		line-height: 1;
		padding: 9px 14px;
		border-radius: 999px;
		font-size: 13px;
		font-weight: 500;
		white-space: nowrap;
		background: rgba(255, 255, 255, 0.06);
		color: var(--settings__row-item-color);
		transition: background 0.18s, color 0.18s, transform 0.12s;
	}
	.settings__row--chips .settings__row-item:hover {
		background: rgba(255, 255, 255, 0.12);
		color: var(--settings__row-item-color-hover);
	}
	.settings__row--chips .settings__row-item:active {
		transform: scale(0.96);
	}
	.settings__row--chips .settings__row-item.active {
		background: var(--settings__row-item-bg-active);
		color: #000;
		font-weight: 600;
		pointer-events: auto;
		box-shadow: 0 2px 8px rgba(255, 163, 50, 0.35);
	}

.settings__row--block {
	display: block;
	background: transparent;
	padding: 0;
}

.feedback__textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 12px 14px;
	border-radius: var(--ios-radius-s);
	border: 1px solid rgba(255, 255, 255, 0.12);
	background: rgba(118, 118, 128, 0.18);
	color: var(--body-color);
	font: inherit;
	font-size: 14px;
	line-height: 1.45;
	resize: vertical;
	min-height: 96px;
	transition: border-color 0.18s, background 0.18s;
}
.feedback__textarea::placeholder {
	color: rgba(var(--txt-rgb), 0.35);
}
.feedback__textarea:focus {
	outline: none;
	border-color: var(--ios-blue);
	background: rgba(118, 118, 128, 0.28);
}

.feedback__captcha {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 12px;
	padding: 10px 12px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: var(--ios-radius-s);
	background: rgba(255, 255, 255, 0.05);
}
.feedback__captcha-label {
	flex: 0 0 auto;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	color: var(--body-color);
	white-space: nowrap;
}
.feedback__captcha-input {
	width: 92px;
	height: 36px;
	box-sizing: border-box;
	padding: 0 10px;
	border-radius: var(--ios-radius-s);
	border: 1px solid rgba(255, 255, 255, 0.12);
	background: rgba(118, 118, 128, 0.18);
	color: var(--body-color);
	font: inherit;
	font-size: 14px;
	text-align: center;
}
.feedback__captcha-input::placeholder {
	color: rgba(var(--txt-rgb), 0.35);
}
.feedback__captcha-input:focus {
	outline: none;
	border-color: var(--ios-blue);
	background: rgba(118, 118, 128, 0.28);
}

.settings__row--submit {
	display: block;
	background: transparent;
	padding: 0;
	margin-top: 18px;
}
	.settings__row-item--primary {
		display: block;
		width: 100%;
		line-height: 44px;
		text-align: center;
		font-size: 15px;
		font-weight: 600;
		color: #000 !important;
		background: var(--ios-blue);
		border-radius: var(--ios-radius-s);
		box-shadow: 0 4px 14px rgba(255, 163, 50, 0.35);
		transition: transform 0.12s, box-shadow 0.18s, opacity 0.18s;
	}
	.settings__row-item--primary:hover {
		box-shadow: 0 6px 18px rgba(255, 163, 50, 0.45);
	}
	.settings__row-item--primary:active {
		transform: scale(0.98);
	}
	.settings__row-item--primary.disabled {
		opacity: 0.55;
		pointer-events: none;
		box-shadow: none;
	}

.feedback__status {
	display: none;
	margin-top: 12px;
	padding: 10px 12px;
	border-radius: var(--ios-radius-s);
	font-size: 13px;
	font-weight: 500;
	text-transform: none;
	letter-spacing: 0;
	color: var(--body-color);
	background: rgba(255, 255, 255, 0.06);
	opacity: 0.92;
}


.chapter__selector-pad {
	display: none;
}


::-webkit-scrollbar {
	width: 10px;
}

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

::-webkit-scrollbar-thumb {
	border-radius: 3px;
	background: var(--scrollbar-thumb);
}

::-webkit-scrollbar-thumb:hover {
	background: rgba(255,255,255,0.38);
}


@media screen and (max-width: 1100px) {
	.action__item-label {
		display: none;
	}
	.bookmark.fixed {
		height: 40px;
	}
}
@media screen and (max-width: 800px) {
	.reader__item {
		min-width: 100%;
	}
	/* Remove empty auto-column — prevents actions from overflowing leftward */
	.header {
		grid-template-columns: 1fr 1fr;
	}
	.chapter__selector {
		display: none;
	}
	.chapter__selector-pad {
		display: flex;
	}
	.settings-tablet {
		display: none;
	}
	.popup__chapters .popup__body {
		padding-left: 5px;
		padding-right: 5px;
	}
	/* Fullscreen is not useful on mobile */
	#reader-fs-btn {
		display: none;
	}
}



@media screen and (max-width: 590px) {
	.reader-root {min-height: 100vh; display: flex; flex-direction: column;}
	.reader-root > .reader-view {flex-grow: 1;}
	.header__post-link {min-width: 60px;}
	.action__item {padding: 0 8px; min-width: 44px;}
	.chapter__selector-trigger {min-width: 90px;}
}

/* ── Mobile ≤ 480px ─────────────────────────────────────────────────────────── */
@media screen and (max-width: 480px) {
	.popup__content {
		max-width: 100% !important;
		border-right: none;
		border-radius: 0;
	}
	.popup__content-right {
		border-left: none;
	}

	.action__item {
		padding: 0 5px;
		min-width: 36px;
	}

	.chapter__selector-footer {
		max-width: 100%;
		padding: 10px 12px 0;
	}
	.chapter__selector-footer__item {
		flex: 1;
		text-align: center;
		padding: 0 10px;
	}

	.footer__nav-links {
		gap: 6px;
	}
	.footer__nav-item {
		font-size: 13px;
		padding: 0 10px;
		height: 34px;
	}
	.footer__actions {
		gap: 6px;
	}
	.footer__action-btn {
		flex: 1;
		justify-content: center;
		padding: 0 10px;
	}

	.nav {
		padding: 8px 12px;
	}
	.nav__paginate-item {
		width: 40px;
		min-height: 36px;
	}
	.nav__pages {
		padding: 0 10px;
		line-height: 36px;
		font-size: 13px;
	}
}

/* ── Mobile ≤ 390px (iPhone SE, base models) ────────────────────────────────── */
@media screen and (max-width: 390px) {
	.header__post-link {
		padding: 0 4px 0 8px;
		gap: 1px;
	}
	.header__back-icon {
		font-size: 15px;
	}
	.header__post-title {
		font-size: 13px;
	}

	.action__item {
		padding: 0 4px;
		min-width: 32px;
		font-size: 15px;
	}

	.popup__settings .popup__body {
		padding: 0 12px 32px;
	}

	.footer__legal {
		flex-wrap: wrap;
		gap: 4px 10px;
	}
}

/* Image long-press context menu */
#reader-img-menu {
	position: fixed;
	z-index: 2000;
	display: none;
	flex-direction: column;
	background: rgba(28, 28, 30, 0.92);
	backdrop-filter: blur(16px) saturate(160%);
	-webkit-backdrop-filter: blur(16px) saturate(160%);
	border: 0.5px solid var(--ios-separator);
	border-radius: var(--ios-radius-m);
	overflow: hidden;
	min-width: 210px;
	box-shadow: 0 8px 32px rgba(0,0,0,0.6);
	pointer-events: none;
}
#reader-img-menu.visible {
	display: flex;
	pointer-events: auto;
}
#reader-img-menu a {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 18px;
	font-size: 15px;
	font-weight: 400;
	color: rgba(var(--txt-rgb), 0.87);
	cursor: pointer;
	border-top: 0.5px solid var(--ios-separator);
	transition: background 0.15s;
}
#reader-img-menu a:first-child {
	border-top: none;
}
#reader-img-menu a:hover,
#reader-img-menu a:active {
	background: rgba(255, 255, 255, 0.08);
}
#reader-img-menu a:last-child {
	color: #FF453A;
}


/* ══════════════════════════════════════════════════════════════════════════════
   OLD-DEVICE SUPPORT — feature detection via @supports / @media
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── backdrop-filter fallback: solid opaque backgrounds ─────────────────────── */
@supports not (backdrop-filter: blur(1px)) {
	.header {
		background: #1e1e1e;
	}
	.bookmark.fixed {
		background: #1e1e1e;
	}
	.chapter__selector-footer__item {
		background: #2c2c2e;
	}
	.nav__pages {
		background: #2c2c2e;
	}
	.footer {
		background: #1c1c1e;
	}
	.popup:before {
		background: rgba(0, 0, 0, 0.72);
	}
	.popup__content {
		background: #1c1c1e;
	}
	.popup__heading {
		background: #1c1c1e;
	}
	#reader-img-menu {
		background: #1c1c1e;
	}
}

/* ── Mobile: disable backdrop-filter on weak GPU (< 600px) ──────────────────── */
@media (max-width: 600px) {
	.header,
	.bookmark.fixed,
	.chapter__selector-footer__item,
	.popup,
	.popup__heading,
	#reader-img-menu {
		backdrop-filter: none !important;
		-webkit-backdrop-filter: none !important;
	}
}

/* ── Reduced motion: disable backdrop-filter blur (causes visual movement) ───── */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
		backdrop-filter: none !important;
		-webkit-backdrop-filter: none !important;
	}
}
/* ── Spread mode: two pages side-by-side (book spine effect) ────────────── */
.reader-view.spread-mode {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	justify-content: center;
	align-items: flex-start;
	gap: 12px;
	padding: 20px 10px;
	position: relative;
}
/* Полоса переплёта по центру */
.reader-view.spread-mode::before {
	content: '';
	position: absolute;
	top: 20px;
	bottom: 0;
	left: 50%;
	width: 12px;
	transform: translateX(-50%);
	background: linear-gradient(to right,
		#0a0806 0%,
		#1c1510 35%,
		#2e2418 50%,
		#1c1510 65%,
		#0a0806 100%
	);
	pointer-events: none;
	z-index: 5;
}
/* Обе страницы — базовые стили */
.reader-view.spread-mode .reader__item-wrap.active {
	display: block;
	flex: 0 0 calc(50% - 16px);
	width: calc(50% - 16px);
	max-width: calc(50% - 16px);
	overflow: hidden;
	position: relative;
	background: #000;
}
/* Левая страница */
.reader-view.spread-mode .reader__item-wrap.active {
	border-radius: 3px 0 0 3px;
	box-shadow:
		inset -28px 0 40px -12px rgba(0,0,0,0.55),
		6px 0 18px rgba(0,0,0,0.5),
		0 6px 28px rgba(0,0,0,0.35);
}
/* Правая страница */
.reader-view.spread-mode .reader__item-wrap.active + .reader__item-wrap.active {
	border-radius: 0 3px 3px 0;
	box-shadow:
		inset 28px 0 40px -12px rgba(0,0,0,0.55),
		-6px 0 18px rgba(0,0,0,0.5),
		0 6px 28px rgba(0,0,0,0.35);
}
.reader-view.spread-mode .reader__item {
	display: block;
	min-width: 0 !important;
	width: 100% !important;
	max-width: 100%;
	height: auto;
	box-shadow: none;
}

/* ── Infinite scroll ─────────────────────────────────────────────────────── */
.chapter-separator {
	text-align: center;
	padding: 28px 16px 20px;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: rgba(var(--txt-rgb), 0.5);
	border-top: 1px solid var(--ios-separator);
	margin-top: 8px;
}
.chapter-separator .fa {
	margin-right: 6px;
	color: var(--ios-blue);
}
.infinite-sentinel {
	min-height: 1px;
}
.infinite-loading,
.infinite-end {
	text-align: center;
	padding: 32px 16px;
	font-size: 13px;
	color: rgba(var(--txt-rgb), 0.35);
}
.infinite-loading .fa-spin {
	margin-right: 6px;
}

/* ── Settings: Spread button hidden on mobile ────────────────────────────── */
.settings-tablet-item {
	display: flex;
	align-items: center;
	justify-content: center;
}
@media (max-width: 800px) {
	.settings-tablet-item {
		display: none;
	}
}

/* ── Brightness slider in settings ──────────────────────────────────────── */
.settings__row--slider {
	align-items: center;
	gap: 12px;
}
.brightness-slider {
	flex: 1 1 0;
	-webkit-appearance: none;
	height: 4px;
	border-radius: 2px;
	background: var(--ios-separator);
	outline: none;
}
.brightness-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--ios-blue);
	cursor: pointer;
}
.brightness-value {
	min-width: 38px;
	text-align: right;
	font-size: 13px;
	color: rgba(var(--txt-rgb), 0.5);
}

/* Reader prompt bar — "Add to collection" suggestion */
.reader-prompt-bar {
	position: fixed;
	left: 15px;
	right: 15px;
	bottom: max(10px, env(safe-area-inset-bottom, 10px));
	z-index: 100;
	padding: 10px 14px;
	background: var(--nav-bg);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	border: 1px solid rgba(255,255,255,0.06);
	border-radius: var(--ios-radius-s);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	box-shadow: 0 -6px 20px rgba(0,0,0,.4);
}
.reader-prompt-bar__text { flex: 1; font-size: 13px; }
.reader-prompt-bar__text .fa { color: var(--ios-blue); margin-right: 6px; }
.reader-prompt-bar__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.reader-prompt-bar__btn {
	border: none;
	cursor: pointer;
	border-radius: var(--ios-radius-s);
	color: #fff;
	font-size: 12px;
	padding: 0 12px;
	min-height: 32px;
	font-family: inherit;
}
.reader-prompt-bar__btn--folder {
	background: rgba(255,255,255,.08);
	font-size: 11px;
	padding: 0 10px;
	min-height: 30px;
}
.reader-prompt-bar__btn--folder:hover { background: var(--ios-blue); color: #000; }
.reader-prompt-bar__btn--ghost {
	background: transparent;
	color: rgba(255,255,255,.45);
	font-size: 11px;
}
.reader-prompt-bar__btn--ghost:hover { color: #fff; }
.prompt-slide-enter-active { animation: promptSlideIn .35s ease-out; }
.prompt-slide-leave-active { animation: promptSlideIn .25s ease-in reverse; }
@keyframes promptSlideIn {
	from { transform: translateY(100%); opacity: 0; }
	to   { transform: translateY(0);    opacity: 1; }
}

/* Safari install help */
.reader-install-sheet {
	position: fixed;
	inset: 0;
	z-index: 1900;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	padding: 16px;
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s ease;
}
.reader-install-sheet.visible {
	opacity: 1;
	pointer-events: auto;
}
.reader-install-sheet__backdrop {
	position: absolute;
	inset: 0;
	border: 0;
	background: rgba(0,0,0,.58);
	cursor: pointer;
}
.reader-install-sheet__panel {
	position: relative;
	width: min(420px, 100%);
	padding: 16px;
	border: 1px solid rgba(255,255,255,.08);
	border-radius: var(--ios-radius-s);
	background: #1c1e20;
	color: #fff;
	box-shadow: 0 18px 48px rgba(0,0,0,.45);
	transform: translateY(18px);
	transition: transform .2s ease;
}
.reader-install-sheet.visible .reader-install-sheet__panel {
	transform: translateY(0);
}
.reader-install-sheet__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
}
.reader-install-sheet__title {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.25;
}
.reader-install-sheet__close {
	height: 34px;
	padding: 0 12px;
	border: 0;
	border-radius: var(--ios-radius-s);
	background: rgba(255,255,255,.08);
	color: var(--ios-blue);
	font: 600 13px/1 Arial,sans-serif;
	cursor: pointer;
}
.reader-install-sheet__steps {
	display: grid;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.reader-install-sheet__steps li {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	padding: 9px 10px;
	border-radius: var(--ios-radius-s);
	background: rgba(255,255,255,.055);
	font-size: 14px;
	line-height: 1.35;
}
.reader-install-sheet__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 28px;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--ios-blue);
	color: #000;
	font-size: 14px;
}
@media (min-width: 680px) {
	.reader-install-sheet {
		align-items: center;
	}
}
@media (prefers-reduced-motion: reduce) {
	.reader-install-sheet,
	.reader-install-sheet__panel {
		transition: none;
	}
}
