/* ==========================================================
   pidruchnyk.com.ua — сторінка книги, закладки, шапка
   ========================================================== */

.m-only { display: none; }
@media (max-width: 1040px) { .m-only { display: block; } }

/* ---------- Шапка: кнопки замість форми входу ---------- */
.hdr-actions { padding: 34px 18px 0 22px; display: flex; flex-direction: column; gap: 10px; }
.ha-btn {
	display: block; padding: 10px 14px; border-radius: 10px; text-decoration: none !important;
	font: 700 14px/1.2 Arial, sans-serif; color: #fff !important; background: rgba(255,255,255,.14);
	border: 1px solid rgba(255,255,255,.28); transition: background .15s;
}
.ha-btn:hover { background: rgba(255,255,255,.26); }
.ha-btn b { display: inline-block; min-width: 20px; margin-left: 4px; padding: 1px 6px; border-radius: 10px; background: #f46604; color: #fff; font-size: 12px; text-align: center; }
.ha-order { background: #f46604; border-color: #f46604; }
.ha-order:hover { background: #e05a00; }

.board-label { font: 700 11px/1 Arial, sans-serif; letter-spacing: 1px; text-transform: uppercase; color: #ffd27a; margin: 0 0 8px; }

@media (max-width: 1040px) {
	.hdr-actions { padding: 0; flex-direction: row; flex-wrap: wrap; gap: 6px; }
	.ha-btn { flex: 1 1 auto; text-align: center; color: #333 !important; background: #f2f2f2; border-color: #e2e2e2; font-size: 13px; padding: 10px 8px; }
	.ha-btn:hover { background: #e8e8e8; }
	.ha-order { background: #f46604; border-color: #f46604; color: #fff !important; flex-basis: 100%; }
	.ha-order:hover { background: #e05a00; }
	.board-label { font-size: 12px; }
}

/* ---------- Хлібні крихти ---------- */
.crumbs { font-size: 13px; color: #888; margin: 4px 0 12px; line-height: 1.5; }
.crumbs a { color: #f46604; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span { margin: 0 4px; color: #bbb; }
.crumbs b { font-weight: normal; color: #666; }

/* ---------- Сторінка книги ---------- */
.book { font-size: 15px; line-height: 1.5; color: #333; }
.book-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.book-head h1 { flex: 1; margin: 0; font: 700 24px/1.25 Arial, sans-serif; color: #222; }
.book-tools a { font-size: 13px; color: #999; }

.book-top { display: flex; gap: 22px; align-items: flex-start; margin-bottom: 18px; }
.book-cover { flex: 0 0 200px; }
.book-cover img { display: block; width: 200px; height: auto; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.18); }
.book-info { flex: 1; min-width: 0; }

.book-props { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.book-props th, .book-props td { text-align: left; padding: 8px 0; border-bottom: 1px solid #eee; vertical-align: top; font-size: 14px; }
.book-props th { width: 140px; color: #888; font-weight: normal; padding-right: 10px; }
.book-props td a { color: #f46604; }

.book-rating { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; }
.book-rating .lbl, .book-share .lbl { font-size: 13px; color: #888; }

.book-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.bbtn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	padding: 11px 18px; border-radius: 10px; border: 2px solid transparent; cursor: pointer;
	font: 700 15px/1.2 Arial, sans-serif; text-decoration: none !important; transition: .15s;
}
.bbtn-read { background: #2f5d50; color: #fff !important; }
.bbtn-read:hover { background: #244a40; }
.bbtn-dl { background: #f46604; color: #fff !important; }
.bbtn-dl:hover { background: #e05a00; }
.bbtn-fav { background: #fff; color: #333; border-color: #ddd; }
.bbtn-fav:hover { border-color: #f46604; }
.bbtn-fav.on { color: #f46604; border-color: #f46604; background: #fff6ef; }

.book-share { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sh { font-size: 13px; padding: 5px 10px; border-radius: 14px; text-decoration: none !important; color: #fff !important; }
.sh-tg { background: #2aa3df; } .sh-vb { background: #7360f2; } .sh-fb { background: #1877f2; } .sh-cp { background: #888; }
.sh:hover { opacity: .85; }

.book .acon-text { margin: 0 0 16px; font-size: 15px; line-height: 1.55; }
.book-gdz { background: #eef7ee; border: 1px solid #cfe7cf; border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; }
.book-gdz a { font-weight: bold; }

.book .tilo-book { display: block; text-align: center; margin: 24px auto 20px; }
.book .tilo-book.empty { display: none; }
.book .tilo-zag { text-align: center; margin: 22px 0 12px; font: 700 18px/1.3 Arial, sans-serif; letter-spacing: 1px; text-transform: uppercase; color: #2f5d50; }
.book .tilo-book iframe { display: block; margin: 0 auto 10px; max-width: 100%; border-radius: 6px; background: #f4f4f4; }

.book-files { background: #fafafa; border: 1px solid #eee; border-radius: 10px; padding: 14px 16px; margin: 0 0 16px; }
.book-files h3 { margin: 0 0 8px; font: 700 15px/1.3 Arial, sans-serif; }
.book-files ul { margin: 0; padding: 0; list-style: none; }
.book-files li { padding: 6px 0; border-bottom: 1px dashed #e5e5e5; word-break: break-word; }
.book-files li:last-child { border-bottom: 0; }
.book-files a { color: #f46604; font-weight: bold; }
.book-files .src, .book-files .hint { margin: 8px 0 0; font-size: 12px; color: #999; }

.gdz-links:empty, .gdz-links:not(:has(a)) { display: none; }
.gdz-links a { display: inline-block; margin: 0 6px 6px 0; padding: 6px 10px; border-radius: 8px; background: #eef7ee; color: #2f5d50 !important; font-size: 13px; font-weight: bold; text-decoration: none; }

.complian { margin: 10px 0 14px; }
.complian a { display: inline-block; padding: 7px 14px; border-radius: 15px; background: #e53935; color: #fff !important; font-size: 13px; text-decoration: none; }

.ad-m { margin: 12px 0; }

/* ---------- Нещодавно переглянуті + панель закладок ---------- */
.recent-box { clear: both; margin: 20px 0; }
.recent-box h3, #related-posts.related-similar h3 { font: 700 16px/1.3 Arial, sans-serif; margin: 0 0 10px; color: #333; text-transform: uppercase; }
.recent-list { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.recent-list .fav-item { display: block; }
.recent-list .fav-img img { width: 100%; height: auto; aspect-ratio: 3/4; object-fit: cover; border-radius: 6px; display: block; }
.recent-list .fav-title { display: block; font-size: 12px; line-height: 1.3; margin-top: 4px; color: #333; text-decoration: none; }

html.fav-open { overflow: hidden; }
.fav-panel { position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; padding: 60px 12px 12px; }
.fav-panel[hidden] { display: none; }
.fav-box { background: #fff; width: 100%; max-width: 560px; max-height: calc(100vh - 80px); display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.fav-tabs { display: flex; border-bottom: 1px solid #eee; }
.fav-tabs button { flex: 1; padding: 14px 10px; background: none; border: 0; font: 700 14px/1 Arial, sans-serif; color: #888; cursor: pointer; border-bottom: 3px solid transparent; }
.fav-tabs button.on { color: #f46604; border-bottom-color: #f46604; }
.fav-tabs .fav-close { flex: 0 0 52px; font-size: 18px; color: #999; }
.fav-list { overflow-y: auto; padding: 8px 14px 14px; }
.fav-list .fav-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.fav-list .fav-img { flex: 0 0 48px; }
.fav-list .fav-img img { width: 48px; height: 64px; object-fit: cover; border-radius: 4px; display: block; }
.fav-list .fav-title { flex: 1; color: #333; font-size: 14px; font-weight: bold; text-decoration: none; line-height: 1.3; }
.fav-list .fav-title:hover { color: #f46604; }
.fav-del { background: none; border: 0; color: #bbb; font-size: 16px; cursor: pointer; padding: 6px; }
.fav-del:hover { color: #e53935; }
.fav-empty { color: #888; text-align: center; padding: 30px 10px; font-size: 14px; }

/* ---------- Вкладки читалок і джерела скачування ---------- */
.reader-tabs { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: 0 0 6px; }
.reader-tabs[hidden] { display: none; }
.rt-lbl { font-size: 13px; color: #888; margin-right: 4px; }
.reader-tabs button { padding: 8px 14px; border-radius: 18px; border: 1px solid #ddd; background: #fff; font: 700 13px/1 Arial, sans-serif; color: #555; cursor: pointer; }
.reader-tabs button.on { background: #2f5d50; border-color: #2f5d50; color: #fff; }
.reader[hidden] { display: none; }
.book-files h3 { font-size: 17px; margin-bottom: 10px; }
.dl-src { padding: 10px 0; border-top: 1px solid #eee; }
.dl-src:first-of-type { border-top: 0; padding-top: 0; }
.dl-name { font: 700 14px/1.3 Arial, sans-serif; color: #333; margin-bottom: 6px; }
.dl-name small { font-weight: normal; color: #999; margin-left: 4px; }
.dl-src ul { display: flex; flex-wrap: wrap; gap: 6px; }
.book-files .dl-src li { padding: 0; border: 0; }
.dl-src li a { display: inline-block; padding: 8px 12px; border-radius: 8px; background: #fff; border: 1px solid #f3c7a5; font-size: 13px; text-decoration: none; }
.dl-src li a:hover { background: #fff6ef; }

/* ---------- Попередні видання ---------- */
.prev-ed { background: #f4f8ff; border: 1px solid #d6e3f7; border-radius: 10px; padding: 14px 16px; margin: 0 0 16px; }
.prev-ed h3 { margin: 0 0 10px; font: 700 17px/1.3 Arial, sans-serif; color: #2b4a7a; }
.prev-ed-body { font-size: 14px; }
.prev-ed-body br { display: none; }
.prev-ed-body a { display: inline-block; margin: 0 6px 6px 0; padding: 8px 12px; border-radius: 8px; background: #fff; border: 1px solid #c9d9f2; color: #2b4a7a !important; font-weight: bold; text-decoration: none; }
.prev-ed-body a:hover { background: #e9f1ff; }

/* ---------- Дві колонки карток на телефоні ---------- */
@media (max-width: 1040px) {
	#category-blocks { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 12px; }
	#category-blocks .category-block { display: contents; }
	#category-blocks .post-container { margin: 0; padding: 0; background: none; text-align: center; }
	#category-blocks .post-thumb img {
		float: none; display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover;
		margin: 0 0 6px; padding: 0; border: 0; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.15);
	}
	#category-blocks .entry-title, #category-blocks .entry-title a { font-size: 14px; line-height: 1.3; }
	#category-blocks .entry-meta { font-size: 12px; }

	.post-entry {
		display: inline-flex; flex-direction: column; vertical-align: top;
		width: calc(50% - 10px); margin: 0 4px 16px; padding: 0; background: none; text-align: center;
	}
	.post-entry h2 { order: 2; font-size: 14px; line-height: 1.3; margin: 0 0 4px; }
	.post-entry .post-body { order: 1; overflow: visible; }
	.post-entry .post-image { float: none; margin: 0 0 6px; }
	.post-entry .post-image img { width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
	.post-entry .post-details { order: 3; }
	.post-entry .post-tags { padding: 0; background: none; }
	.post-entry .post-tags a { margin: 0 2px 4px; padding: 3px 6px; font-size: 11px; }
}

/* ---------- Телефони ---------- */
@media (max-width: 1040px) {
	.book-head h1 { font-size: 20px; }
	.book-top { gap: 14px; }
	.book-cover { flex: 0 0 110px; }
	.book-cover img { width: 110px; }
	.book-props th { width: auto; }
	.book-props th, .book-props td { font-size: 13px; padding: 6px 0; }
	.bbtn { flex: 1 1 auto; }
	.recent-list { grid-template-columns: repeat(3, 1fr); }
	.fav-panel { padding: 20px 8px 8px; }
	body:has(#book) #header > .study_6 { display: none; }
	.ha-recent { font-size: 0 !important; }
	.ha-recent::after { content: "🕘 Переглянуті"; font-size: 13px; }
	.ha-fav, .ha-recent { flex: 1 1 40%; }
}
@media (max-width: 560px) {
	.book-top { flex-wrap: wrap; }
	.book-info { flex-basis: 100%; }
	.book-cover { flex: 0 0 auto; margin: 0 auto; }
	.book-cover img { width: 140px; }
	.book-btns .bbtn { flex: 1 1 100%; }
}
