/* Kế hoạch A — trang xem sách lật /sach-lat/<id>/. Màu theo docs/brand.md; mobile-first (380 px). */
:root {
	--sl-chinh: #007A29;
	--sl-chinh-dam: #004D1A;
	--sl-chu: #1B2A21;
	--sl-phu: #4F5E55;
	--sl-ke: #D5DDD8;
	--sl-nen: #EAEFEC;
	--sl-nen-la: #E8F5EC;
	--sl-trang: #FFFFFF;
	--sl-cc: 52px; /* chiều cao thanh công cụ */
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body.sl {
	margin: 0;
	display: flex;
	flex-direction: column;
	height: 100vh;
	height: 100dvh;
	overflow: hidden;
	background: var(--sl-nen);
	color: var(--sl-chu);
	font: 400 15px/1.5 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	-webkit-text-size-adjust: 100%;
}
.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px; margin: -1px; padding: 0;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hcmunre-icon { flex: none; display: block; }
:focus-visible { outline: 3px solid var(--sl-chinh); outline-offset: 2px; }

.site-test-banner {
	flex: none;
	padding: 4px 16px;
	background: #FFFFCC;
	color: #734D26;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.4;
	text-align: center;
	border-bottom: 1px solid var(--sl-ke);
}

/* Đầu trang: ← bài gốc · tên tài liệu */
.sl-dau {
	flex: none;
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 48px;
	padding: 4px 12px 4px 4px;
	padding-top: max(4px, env(safe-area-inset-top));
	background: var(--sl-trang);
	border-bottom: 1px solid var(--sl-ke);
}
.sl-ve {
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-width: 44px;
	min-height: 44px;
	padding: 0 8px;
	border-radius: 8px;
	color: var(--sl-chinh);
	font-weight: 600;
	text-decoration: none;
}
.sl-ve:hover { background: var(--sl-nen-la); }
.sl-ve__chu { display: none; }
.sl-ten {
	flex: 1;
	min-width: 0;
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.sl-ten__meta { display: none; color: var(--sl-phu); font-weight: 400; font-size: 13px; }

/* Vùng sách */
.sl-khung {
	flex: 1;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 12px 8px;
	overflow: hidden;
}
.sl-san { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.sl-vo { max-width: 100%; }
.sl-xem-truoc { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; background: var(--sl-trang); box-shadow: 0 2px 10px rgba(27, 42, 33, .18); }
.sl-trang {
	background: var(--sl-trang);
	overflow: hidden;
}
.sl-trang::before {
	content: attr(data-tai);
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--sl-phu);
	font-size: 13px;
}
.sl-trang img {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: var(--sl-trang);
	user-select: none;
	-webkit-user-select: none;
}
.sl-trang img:not([src]) { visibility: hidden; }
.stf__parent { filter: drop-shadow(0 2px 10px rgba(27, 42, 33, .18)); }

/* Không JavaScript: cuộn dọc từng trang */
.sl-cuon { width: 100%; max-width: 900px; height: 100%; overflow-y: auto; display: grid; gap: 12px; align-content: start; }
.sl-cuon img { width: 100%; height: auto; background: var(--sl-trang); }

/* Thanh công cụ: dưới đáy (điện thoại và máy tính) */
.sl-cc {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 4px;
	min-height: var(--sl-cc);
	padding: 4px 8px;
	padding-bottom: max(4px, env(safe-area-inset-bottom));
	background: var(--sl-trang);
	border-top: 1px solid var(--sl-ke);
}
.sl-cc__lat, .sl-cc__khac { display: flex; align-items: center; gap: 2px; }
.sl-nut {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: 40px;
	height: 44px;
	padding: 0 8px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--sl-chinh-dam);
	font: inherit;
	font-weight: 600;
	font-size: 14px;
	text-decoration: none;
	cursor: pointer;
}
.sl-nut:hover { background: var(--sl-nen-la); }
.sl-nut__chu { display: none; }
.sl-so { display: inline-flex; align-items: center; gap: 4px; color: var(--sl-phu); font-size: 14px; font-variant-numeric: tabular-nums; }
.sl-so input {
	width: 3.4em;
	height: 36px;
	padding: 0 4px;
	border: 1px solid var(--sl-ke);
	border-radius: 6px;
	color: var(--sl-chu);
	font: inherit;
	font-weight: 600;
	text-align: center;
	-moz-appearance: textfield;
}
.sl-so input::-webkit-outer-spin-button, .sl-so input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Toàn màn hình (API hoặc lớp phủ): ẩn dải thử nghiệm + đầu trang */
body.sl--toan .site-test-banner, body.sl--toan .sl-dau { display: none; }
body.sl--toan .sl-khung { padding: 4px; }

/* Lớp phủ phóng to */
.sl-phong {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: flex;
	flex-direction: column;
	background: rgba(20, 30, 24, .94);
}
.sl-phong[hidden] { display: none; }
.sl-phong__cc {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 2px;
	padding: 4px 8px;
	padding-top: max(4px, env(safe-area-inset-top));
	background: var(--sl-trang);
}
.sl-phong__so { min-width: 7.5em; text-align: center; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sl-nut--dong { margin-left: auto; }
.sl-phong__cuon {
	flex: 1;
	min-height: 0;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	padding: 8px;
	text-align: center;
	cursor: grab;
}
.sl-phong__cuon.dang-keo { cursor: grabbing; }
.sl-phong__cuon img { display: inline-block; max-width: none; height: auto; background: var(--sl-trang); vertical-align: top; }

@media (min-width: 600px) {
	.sl-ve__chu { display: inline; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
	.sl-nut--chu .sl-nut__chu { display: inline; }
	.sl-ten__meta { display: inline; }
	.sl-khung { padding: 16px; }
	.sl-cc { justify-content: center; gap: 24px; }
}
@media (min-width: 1024px) {
	.sl-dau { padding-left: 12px; }
	.sl-ten { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
	* { scroll-behavior: auto !important; }
}
