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

html,
body {
	margin: 0 !important;
	padding: 0 !important;
	padding-bottom: env(safe-area-inset-bottom, 0px) !important;
	border: none !important;
	outline: none !important;
	vertical-align: baseline !important;
	width: 100%;
	overflow-x: hidden;
}

:root {
	--safe-top: env(safe-area-inset-top, 0px);
	--safe-bottom: env(safe-area-inset-bottom, 0px);
}

.site-header {
	margin-top: 0 !important;
	padding-top: var(--safe-top) !important;
	display: block !important;
	position: sticky !important;
	z-index: 1000 !important;
	top: 0 !important;
	background: #fff !important;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
	border-bottom: 1px solid rgba(0, 0, 0, 0.03) !important;
	transform: translateZ(0);
	/* Fix mobile sticky rendering jitter */
}

.container {
	width: 100% !important;
	max-width: 1200px !important;
	margin: 0 auto !important;
	padding-left: 16px !important;
	padding-right: 16px !important;
	box-sizing: border-box !important;
}

/* Loading Spinner */
.loading-wrapper {
	text-align: center;
	padding: 40px;
	color: #888;
	width: 100%;
}

.loading-spinner {
	display: inline-block;
	font-size: 32px;
	margin-bottom: 12px;
	animation: spin-global 1.5s linear infinite;
}

@keyframes spin-global {
	from {
		transform: rotate(0deg);
	}

	to {
		transform: rotate(360deg);
	}
}

.site-header .brand,
.site-header .controls {
	margin-top: 0 !important;
}

/* 1. 確保動態新增的輸入框寬度與書名一致 */
#links-container {
	padding-right: 4px;
}

#links-container .link-row input {
	/* margin: 0 !important; */
	/* border: 1px solid #ccc !important; */
	height: 40px;
}

.tag-badge {
	display: inline-block;
	background-color: #f0f0f0;
	color: #555;
	padding: 4px 10px;
	border-radius: 15px;
	margin-right: 8px;
	margin-bottom: 5px;
	font-size: 14px;
	border: 1px solid #ddd;
}

/* 2. 修正刪除按鈕 (X) 的顏色與位置 */
.link-row {
	display: flex;
	gap: 10px;
	margin-bottom: 12px;
	align-items: center;
	width: 100%;
}

.link-delete-btn {
	color: #311C20;
	cursor: pointer;
	font-weight: bold;
	font-size: 18px;
	flex-shrink: 0;
}

/* 3. 新增連結按鈕：改為後台風格（灰框小按鈕） */
#add-link-btn,
#add-social-btn {
	all: unset;
	display: inline-block;
	width: fit-content;
	padding: 4px 12px;
	background: #f8f9fa;
	border: 1px solid #ccc;
	border-radius: 4px;
	color: #333;
	font-size: 14px;
	cursor: pointer;
	text-align: center;
}

#add-link-btn:active,
#add-social-btn:active {
	background: #e0e0e0;
	transform: translateY(1px);
}

/* 修正 18 禁勾選框的樣式 */
.inline-check {
	display: inline-flex !important;
	align-items: center;
	gap: 12px !important;
	white-space: nowrap;
	cursor: pointer;
	margin-top: 8px;
	justify-content: flex-start;
}

.inline-check input[type="checkbox"] {
	width: 18px !important;
	height: 18px !important;
	margin: 0 !important;
}

/* 1. Define button base styles */
.tags-container {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	/* Consistent spacing */
}

/* Ensure inline tag input doesn't break layout */
.add-tag-wrapper {
	display: inline-flex;
	align-items: center;
}

#add-tag-input-container {
	display: flex;
	/* Override possible inline styles */
	align-items: center;
	gap: 4px;
}

/* 1. 定義統一的按鈕基礎與滑動樣式 */
#admin-banner-submit,
#admin-banner-delete,
.admin-add-btn,
button[type="submit"] {
	transition: all 0.1s ease;
	cursor: pointer;
}

/* 2. 滑鼠移上去時的狀態 */
#admin-banner-submit:hover,
#admin-banner-delete:hover,
.admin-add-btn:hover {
	background-color: #f0f0f0;
	filter: brightness(0.9);
}

/* 3. 點擊時 (Click/Active) 的狀態 */
#admin-banner-submit:active,
#admin-banner-delete:active,
.admin-add-btn:active {
	background-color: #e0e0e0 !important;
	transform: translateY(1px);
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* admin banner 按鈕點擊互動同步 admin-add-btn */
#admin-banner-submit,
#admin-banner-delete {
	transition: background 0.1s, color 0.1s, border 0.1s, transform 0.1s;
}

#admin-banner-submit:active,
#admin-banner-delete:active {
	background: #e0e0e0 !important;
	color: #111 !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	transform: scale(0.98);
}

/* 強制讓新增按鈕與送出按鈕樣式相同 */
button#admin-add-submit,
#admin-banner-submit,
#admin-banner-delete {
	background: #f8f9fa;
	border: 1px solid #ccc;
	color: #333;
	padding: 4px 12px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
}

/* 移除原本可能影響樣式的設定 */
.admin-add-btn {
	background: none !important;
	border: 1px solid #ccc !important;
	color: #000 !important;
}

/* Admin Tabs RWD */
.admin-tabs {
	display: flex !important;
	gap: 4px !important;
	margin-bottom: -1px !important;
	position: relative !important;
	z-index: 2 !important;
	overflow-x: auto !important;
	white-space: nowrap !important;
	padding-bottom: 4px !important;
	-webkit-overflow-scrolling: touch !important;
}

.admin-tabs::-webkit-scrollbar {
	display: none !important;
}

.admin-content-box {
	background: #fff !important;
	border: 1px solid rgba(0, 0, 0, 0.08) !important;
	border-radius: 0 12px 12px 12px !important;
	padding: 24px !important;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03) !important;
}

.tab-btn {
	flex: 0 0 auto !important;
	padding: 8px 16px !important;
	background: #f8f9fa !important;
	border: 1px solid rgba(0, 0, 0, 0.08) !important;
	border-bottom: none !important;
	border-radius: 8px 8px 0 0 !important;
	cursor: pointer !important;
	font-weight: bold !important;
	color: #666 !important;
}

.tab-btn.active {
	background: #fff !important;
	color: var(--primary) !important;
	border-bottom: 1px solid #fff !important;
}

.admin-section {
	display: none;
}

.admin-section.active {
	display: block !important;
}

/* 後台專用新增按鈕 id 樣式 */
#admin-add-submit {
	background: #fff;
	color: #111;
	border: 1px solid #bbb;
	font-weight: 700;
	border-radius: 4px;
	padding: 4px 14px;
	box-shadow: none;
	transition: background .18s, color .18s, border .18s;
	width: auto;
	min-width: 0;
	display: inline-block;
	margin: 0 auto;
	font-size: 18px;
	cursor: pointer;
}

#admin-add-submit:hover,
#admin-add-submit:focus {
	background: #f5f5f5;
	color: #111;
	border-color: #111;
}

/* 後台專用新增按鈕樣式 */
.admin-add-btn {
	background: #fff;
	color: #111;
	border: 1px solid #bbb;
	font-weight: 700;
	border-radius: 4px;
	padding: 4px 14px;
	box-shadow: none;
	transition: background .18s, color .18s, border .18s;
	width: auto;
	min-width: 0;
	display: inline-block;
	margin: 0 auto;
	font-size: 18px;
	cursor: pointer;
}

.admin-add-btn:hover,
.admin-add-btn:focus {
	background: #f5f5f5;
	color: #111;
	border-color: #111;
}

/* 強制 +新增連結 按鈕為灰底黑字 */
#add-link-btn,
#add-social-btn {
	background: #eee !important;
	color: #111 !important;
	border: 1px solid #bbb !important;
	font-weight: 900;
	width: fit-content !important;
	/* Force override of #add-form button width */
}

/* Hover removed as requested */

#add-form .meta-col {
	align-items: flex-start !important;
	padding-left: 0 !important;
}

#add-form .row {
	justify-content: flex-start !important;
	align-items: flex-start !important;
	padding-left: 0 !important;
	margin-left: 0 !important;
}

#add-form .row .inline-check,
#add-form .inline-check label,
#add-form .inline-check {
	justify-content: flex-start !important;
	align-items: center !important;
	text-align: left !important;
}

/* === 全站 RWD 響應式 === */
@media (max-width: 1023px) {
	.container {
		max-width: 100%;
		padding: 12px;
	}
}

/* Unified Banner Layout */
/* Unified Banner Layout - Default Left Aligned for Account/Activity */
.banner {
	width: 100% !important;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	padding: 12px 16px !important;
	margin: 10px auto !important;
	background: #fff !important;
	border-radius: 12px !important;
	border: 1px solid rgba(0, 0, 0, 0.03) !important;
	box-sizing: border-box !important;
}

/* Homepage Only Centering & Style */
.home-banner {
	display: block !important;
	background: linear-gradient(110deg, #f0f0f0 8%, #f8f8f8 18%, #f0f0f0 33%);
	background-size: 200% 100%;
	animation: banner-skeleton 1.5s infinite linear;
	border: none;
	padding: 0;
	position: relative;
	overflow: hidden;
}

@keyframes banner-skeleton {
	0% {
		background-position: -100% 0;
	}

	100% {
		background-position: 100% 0;
	}
}

.home-banner,
.banner-slide {
	position: relative;
	width: 100%;
	/* aspect-ratio removed to allow RWD */
	overflow: hidden;
}

.banner-track {
	display: flex !important;
	flex-wrap: nowrap !important;
	height: auto !important;
	/* Allow content to dictate height */
	will-change: transform;
	transition: transform 0.5s ease-in-out;
	justify-content: flex-start;
}

.banner-row img {
	max-width: 100%;
	height: auto;
	object-fit: cover;
}

.banner-track .banner-slide {
	max-width: none !important;
	margin: 0 !important;
	border-radius: 0 !important;
	flex: 0 0 auto !important;
	/* Allow width from JS */
}

.home-banner {
	width: 100% !important;
	/* Follow container width */
	height: auto !important;
	aspect-ratio: auto !important;
	margin: 0 0 20px 0 !important;
	padding: 0 !important;
	background: #f0f0f0;
	background-size: cover;
	overflow: hidden;
	border-radius: 12px;
	/* Restore rounded corners if desired inside container */
}

.banner-slide {
	background-size: cover !important;
	/* Default for desktop to fill */
	background-position: center center !important;
}

/* 手機版 Banner 設定 */
@media screen and (max-width: 768px) {
	.home-banner {
		height: auto !important;
		aspect-ratio: auto !important;
		width: 100% !important;
	}

	.banner-track {
		height: auto !important;
	}
}

/* Explicit Image Reset */
.banner-slide img {
	width: 100% !important;
	height: auto !important;
	object-fit: contain !important;
	/* Protect against any global cover rules */
	display: block !important;
	max-width: 100%;
}





/* Conflicting block removed in favor of unified header RWD at bottom */

@media (min-width: 1024px) {
	.grid {
		grid-template-columns: repeat(5, 1fr);
	}

	#add-form .inline-check {
		gap: 12px !important;
	}
}

@media (min-width: 768px) and (max-width: 1023px) {
	.grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 767px) {
	.grid {
		grid-template-columns: 1fr;
	}
}

/* 導覽列 RWD（手機漢堡選單可後續補 JS） */
:root {
	--primary: #FFA94D;
	--bg: #FFF9F2;
	--text: #4A3B41;
	--muted: #FFC1D6;
	--hover-bg: #FFF7ED
}

* {
	box-sizing: border-box
}

body {
	margin: 0 !important;
	font-family: "Microsoft JhengHei", Arial, sans-serif;
	background: var(--bg);
	color: var(--text)
}

.container {
	max-width: 1100px;
	margin: 0 auto;
	padding: 20px
}

/* Consolidated into top declaration */

.site-header .container {
	display: flex;
	align-items: center;
	justify-content: space-between
}

.brand {
	font-weight: 900;
	font-size: 20px;
	color: #311C20;
	text-decoration: none
}

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

.controls input {
	padding: 8px 12px 8px 35px;
	border-radius: 10px;
	border: 1px solid #E6D5C3;
	background: #fff;
	background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23311C20" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>');
	background-repeat: no-repeat;
	background-position: 10px center;
	outline: none;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.controls input:focus {
	border-color: #FFA94D !important;
	box-shadow: 0 0 0 3px rgba(255, 169, 77, 0.1);
}

.controls button {
	background: var(--primary);
	color: #fff;
	padding: 8px 12px;
	border-radius: 10px;
	border: none;
	font-weight: 800
}

.icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 1px solid rgba(0, 0, 0, 0.04);
	padding: 8px;
	border-radius: 10px;
	cursor: pointer;
	margin-left: 6px
}

.icon-btn svg,
.icon-btn img {
	display: block;
	width: 18px;
	height: 18px;
	object-fit: contain;
}

.icon-btn.settings img {
	width: 32px;
	height: 32px;
}

.icon-btn:not(#btn-add):hover,
.btn-icon:hover,
.categories button:not(.active):hover,
.chip:hover,
.cover-box:hover {
	background: var(--hover-bg);
}

/* Force fixed size for Account Button */
#btn-account {
	width: 42px !important;
	height: 34px !important;
	min-width: 42px !important;
	/* Prevent squashing in flex */
	flex: 0 0 auto !important;
	/* Prevent growing/shrinking */
	padding: 0 !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	background: #785338 !important;
	border-color: #785338 !important;
}

#btn-account img {
	filter: brightness(0) invert(1);
	/* Make icon white */
}

/* Hide add button by default (shown only when logged in) */
#btn-add {
	display: none !important;
}

#btn-add.show {
	display: flex !important;
}

/* Primary buttons keep primary color but slightly highlight on hover */
.btn-primary:hover,
#add-form button.primary:hover,
.btn-ghost:hover {
	background: var(--hover-bg);
}

/* admin panel */
.admin-panel {
	position: fixed;
	inset: 60px 20px 20px 20px;
	z-index: 80;
	display: flex;
	align-items: flex-start;
	justify-content: center
}

.admin-panel.hidden {
	display: none
}

.admin-inner {
	background: #fff;
	padding: 20px;
	border-radius: 12px;
	width: 100%;
	max-width: 980px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
	border: 1px solid rgba(0, 0, 0, 0.04)
}

.admin-inner h2 {
	margin: 0 0 8px
}

.admin-inner .muted {
	color: rgba(0, 0, 0, 0.45);
	margin-bottom: 12px
}

.admin-actions {
	display: flex;
	gap: 8px
}

.btn-primary {
	background: var(--primary);
	color: #fff;
	padding: 10px 18px;
	border-radius: 10px;
	border: none;
	font-weight: 900;
	font-size: 16px;
	box-shadow: none;
	transition: background .18s;
}

.btn-primary:hover,
.btn-primary:focus {
	background: var(--hover-bg);
	color: var(--primary);
	box-shadow: 0 2px 8px rgba(255, 169, 77, 0.08);
}

.btn-primary:active {
	background: var(--primary);
	color: #fff;
}

.btn-ghost {
	background: transparent;
	border: 1px solid rgba(0, 0, 0, 0.06);
	padding: 8px 12px;
	border-radius: 10px
}

.banner {
	background: #fff;
	padding: 12px;
	margin: 12px 0;
	border-radius: 12px;
	border: 1px solid rgba(0, 0, 0, 0.03);
}

/* large homepage-only banner */
.home-banner {
	/* width & height removed to allow aspect-ratio to work */
	margin: 0 auto 20px auto;
	border-radius: 12px;
	background-size: cover;
	/* Fallback/Base */
	background-position: center;
	background-repeat: no-repeat;
	overflow: hidden;
	border: 1px solid rgba(0, 0, 0, 0.03);
	position: relative;
}

.banner-slide {
	position: relative;
	width: auto;
	height: 100%;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	transition: opacity 0.5s;
	will-change: transform, opacity;
}

.home-banner h1 {
	display: none
}

.categories {
	display: flex;
	gap: 8px;
	overflow: auto;
	padding: 12px 0
}

.categories button {
	-webkit-appearance: none;
	appearance: none;
	padding: 8px 14px;
	border-radius: 999px;
	border: 1px solid rgba(0, 0, 0, 0.05);
	background: #fff;
	font-weight: 900;
	cursor: pointer;
	min-width: 110px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #311C20;
	box-sizing: border-box;
	-webkit-tap-highlight-color: transparent;
	user-select: none;
	-webkit-user-select: none;
}

/* 360px 尺寸下調整 categories 按鈕寬度 */
@media (max-width: 375px) {
	.categories {
		justify-content: flex-start !important;
		align-items: center !important;
		padding-left: 0 !important;
		padding-right: 0 !important;
		margin-left: 0 !important;
		margin-right: 0 !important;
	}

	.categories button {
		flex: 0 0 auto;
		min-width: 70px !important;
		max-width: calc((100% - 16px) / 3);
		padding: 8px 10px !important;
		font-size: 14px !important;
		justify-content: center !important;
		align-items: center !important;
		font-weight: 900 !important;
		box-sizing: border-box !important;
	}
}

.categories button.active {
	background: var(--primary);
	color: #fff;
	border-color: var(--primary)
}

.grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 20px;
	margin: 18px 0
}

.card {
	background: #fff;
	border-radius: 18px;
	border: 1px solid rgba(0, 0, 0, 0.03);
	overflow: hidden;
	display: flex;
	flex-direction: column
}

.card .cover {
	height: 260px;
	background: linear-gradient(180deg, #ffeef3, #fff);
	display: flex;
	align-items: center;
	justify-content: center
}

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

.card .body {
	padding: 18px;
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: space-between
}

.card h3 {
	margin: 0 0 6px;
	font-size: 16px
}

.card p {
	margin: 0 0 8px;
	color: var(--primary)
}

.card .meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-weight: 800;
	font-size: 12px
}

.rating-pill {
	color: var(--primary);
	border: 1px solid var(--primary);
	padding: 0 10px;
	border-radius: 999px;
	font-weight: 800;
	display: inline-flex;
	align-items: center;
	height: 32px
}

.card .actions {
	display: flex;
	gap: 8px;
	align-items: center
}

.btn-icon {
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.04);
	padding: 8px;
	border-radius: 8px;
	cursor: pointer
}

.fav-img {
	width: 32px;
	height: 32px;
	display: inline-block;
	vertical-align: middle
}

.btn-icon.fav {
	border: none;
	background: url('ICON/heart.png') no-repeat center center !important;
	background-size: 24px 24px !important;
	padding: 0 4px;
	border-radius: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 32px;
	width: 40px;
	transition: transform 0.1s;
}

.btn-icon.fav:hover {
	transform: scale(1.1);
}

.btn-icon.fav.active {
	background: url('ICON/heart(ON FILL).svg') no-repeat center center !important;
	background-size: 24px 24px !important;
	filter: none !important;
	color: var(--primary)
}

.modal {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.35);
	z-index: 99999;
}

.modal.hidden {
	display: none
}

/* 統一所有頁面的彈窗內容樣式 */
.modal-content,
.modal-inner {
	width: 500px !important;
	/* 強制固定寬度與首頁一致 */
	max-width: calc(100% - 32px) !important;
	/* 行動裝置適應 */
	max-height: 85vh;
	/* 限制高度 */
	background: #fff;
	border-radius: 20px;
	padding: 30px;
	position: relative;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	/* 內容超過時可滑動 */

	/* 隱藏捲軸樣式 */
	scrollbar-width: none;
	/* Firefox */
	-ms-overflow-style: none;
	/* IE/Edge */
	padding-top: 10px;
	/* Space for sticky close */
}

/* 針對 Chrome/Safari 隱藏捲軸 */
.modal-content.add-form-style::-webkit-scrollbar,
.modal-inner::-webkit-scrollbar {
	display: none;
}

/* 確保內部的 grid 佈局一致 */
.modal-grid {
	display: flex;
	gap: 20px;
	align-items: flex-start;
	margin-bottom: 20px;
}

.cover-col {
	width: 140px;
	flex-shrink: 0;
}

.meta-col {
	flex: 1;
}

@media (max-width: 767px) {
	.modal-grid {
		flex-direction: column;
	}

	.cover-col,
	.meta-col {
		width: 100%;
	}
}

.modal-close {
	position: sticky;
	top: 0;
	align-self: flex-end;
	z-index: 10;
	border: none;
	background: #fff;
	/* Match modal bg */
	font-size: 22px;
	cursor: pointer;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	line-height: 1;
	margin-bottom: -32px;
	/* Don't take up space in flow if possible */
}

.adult-badge {
	position: absolute;
	top: 5px;
	right: 5px;
	background: #ff4d4d;
	color: #fff;
	font-size: 10px;
	font-weight: 900;
	padding: 2px 4px;
	border-radius: 4px;
	z-index: 5;
	pointer-events: none;
}

#add-form input,
#add-form select,
#add-form textarea {
	width: 100%;
	padding: 10px;
	margin: 8px 0;
	border-radius: 10px;
	border: 1px solid rgba(0, 0, 0, 0.06)
}

#add-form .row {
	margin: 0 !important;
	padding: 0 !important;
}

#add-form .tag-input {
	margin-left: 0;
}

#add-form .row:has(.inline-check) {
	margin: 0 !important;
	padding: 0 !important;
}

#add-form .inline-check {
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: flex-start;
	gap: 8px;
	margin-top: 15px;
	margin-bottom: 0;
	margin-left: 0;
	padding-left: 0;
	width: 100%;
	box-sizing: border-box;
}

@media (max-width: 767px) {
	#add-form .inline-check {
		gap: 10px !important;
		min-height: 44px;
		width: 100%;
		white-space: nowrap;
	}
}

#add-form .inline-check input {
	margin: 0 !important;
}

#add-form button {
	background: var(--primary);
	color: #fff;
	padding: 10px 12px;
	border-radius: 10px;
	border: none;
	width: 100%;
	font-weight: 900
}

@media (max-width:600px) {
	.banner h1 {
		font-size: 20px
	}

	.container {
		padding: 12px
	}
}

/* ---- 新增調整：封面上傳、modal 標題、輸入 focus、分類 hover ---- */
/* Modal 標題色 */
.modal-inner h2 {
	color: #311C20;
}

/* Cover 上的 icon 與文字排列（icon 在上方，大小 20x20，文字色為主色） */
.cover-placeholder {
	flex-direction: column;
	gap: 8px;
	color: var(--text);
	display: flex;
}

.cover-placeholder .file-icon {
	width: 20px;
	height: 20px;
	display: block;
	margin-bottom: 6px;
	color: var(--primary);
}

.cover-placeholder .cover-text {
	color: var(--primary);
	font-weight: 700;
}

/* 點擊 input 或 focus 到外層時，外層框顯示主色邊框與淡色 focus ring */
.cover-box {
	width: 132px;
	height: 176px;
	display: block;
	border-radius: 16px;
	overflow: hidden;
	border: 2px dashed rgba(0, 0, 0, 0.08);
	background: rgba(255, 234, 213, 0.25);
	position: relative;
	transition: border-color .18s ease, box-shadow .18s ease;
}

.cover-box:hover {
	border-color: var(--primary);
	background: rgba(255, 234, 213, 0.4);
}

.cover-box:focus-within {
	border-color: var(--primary);
	box-shadow: 0 6px 20px rgba(255, 169, 77, 0.12);
}

.cover-box input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
	z-index: 2;
}

.cover-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	color: #8b6b4a;
	font-weight: 600;
}

.cover-placeholder img.cover-preview {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.cover-placeholder .file-icon {
	margin-bottom: 8px;
	opacity: 0.6;
}

.cover-placeholder .cover-text {
	font-size: 14px;
	opacity: 0.8;
}

#add-form input:focus,
#add-form textarea:focus,
#add-form select:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 6px 20px rgba(255, 169, 77, 0.08);
}

/* 作品分類 hover（包括 select hover 以及 categories 按鈕） */
#cat-select:hover,
#cat-select:focus {
	background: var(--hover-bg);
}

.categories button:not(.active):hover {
	background: var(--hover-bg);
}

/* 微調：保持按鈕 hover 與元件一致性 */
.btn-primary:hover,
.btn-icon:hover,
.icon-btn:not(#btn-add):hover {
	filter: brightness(1.02);
}

/* 取消「確認新增並發布」按鈕的 hover 狀態（保持外觀不變） */
#add-form button.primary:hover,
#add-form button.primary:focus,
#add-form button.primary:active {
	background: var(--primary);
	filter: none;
	box-shadow: none;
	transform: none;
}

/* 下拉選單（select / option）樣式調整：強制白底，hover/selected 使用 --hover-bg */
select,
#cat-select {
	background: #fff;
	color: var(--text);
	border-radius: 8px;
	padding: 10px 36px 10px 12px;
	border: 1px solid rgba(0, 0, 0, 0.06);
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23311C20' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
	background-repeat: no-repeat;
	background-position: right 10px center;
}

/* option 背景與 hover/selected（使用 !important 以覆蓋部分 UA 樣式） */
select option,
#cat-select option {
	background: #fff;
	color: var(--text);
}

select option:hover,
select option:checked,
select option:active,
#cat-select option:hover,
#cat-select option:checked,
#cat-select option:active {
	background: var(--hover-bg) !important;
	color: var(--text) !important;
}

/* 隱藏 IE/Edge 預設箭頭（視情況保留） */
select::-ms-expand {
	display: none;
}

/* hide elements marked admin-only by default */
[data-admin-only] {
	display: none;
}

/* account button hover: primary color */
#btn-account.icon-btn:hover,
#btn-account.icon-btn:focus,
#btn-account.icon-btn:active {
	background: var(--primary);
	color: #fff;
	filter: none;
}

/* keep settings button static by default (no hover color) */
.icon-btn.settings {
	background: #fff;
}

#btn-settings.icon-btn:hover,
#btn-settings.icon-btn:focus,
#btn-settings.icon-btn:active {
	background: #fff;
	filter: none;
}

/* search input: add magnifier icon and left padding */
#search {
	padding-left: 36px;
	background-repeat: no-repeat;
	background-position: 12px center;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23311C20' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
}

/* search focus state (click) */
#search:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 6px 20px rgba(255, 169, 77, 0.08);
}

/* account / admin back button */
#back-home {
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.06);
	padding: 8px 10px;
	border-radius: 8px;
	cursor: pointer;
	color: #311C20;
	text-decoration: none;
	display: inline-block
}

/* utility: disable hover visuals */
.no-hover:hover {
	background: transparent !important;
	filter: none !important;
	box-shadow: none !important;
}

/* admin toggle button styles */
#admin-toggle {
	background: var(--primary);
	color: #fff;
	border: none;
	padding: 8px 12px;
	border-radius: 8px;
	cursor: pointer
}

#admin-toggle.active {
	background: #311C20;
	color: #fff
}

/* admin panel styles */
.admin-panel {
	position: fixed;
	right: 20px;
	top: 80px;
	z-index: 120;
	display: none;
	align-items: flex-start;
	justify-content: center
}

.admin-panel .admin-inner {
	width: 360px;
	padding: 12px
}

.admin-panel.active {
	display: flex
}

.admin-panel input[type=file] {
	display: block;
	margin-bottom: 8px
}

/* comments modal */
#comments-modal .modal-inner {
	max-width: 640px
}

#comments-modal .comment {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.04)
}

/* ensure admin panel hidden by default and only shows when active */
.admin-panel {
	display: none !important;
	position: fixed;
	right: 20px;
	top: 80px;
	z-index: 120;
	align-items: flex-start;
	justify-content: center
}

.admin-panel.active {
	display: flex !important
}

/* admin banner thumbnail style and checkbox overlay */
.admin-banner-thumb {
	position: relative;
	width: 140px;
	height: 70px;
	margin-right: 8px
}

.admin-banner-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border: 1px solid #eee;
	border-radius: 8px;
	display: block
}

.admin-banner-thumb input[type="checkbox"] {
	position: absolute;
	left: 8px;
	top: 8px;
	width: 18px;
	height: 18px;
	z-index: 10;
	background: rgba(255, 255, 255, 0.9);
	border-radius: 4px
}

/* admin 快速新增作品按鈕樣式統一 */
#admin-add-form button[type="submit"] {
	background: #fff;
	color: #111;
	border: 1px solid #888;
	font-weight: 700;
	border-radius: 4px;
	padding: 4px 14px;
	box-shadow: none;
	transition: background .18s, color .18s, border .18s;
	width: auto;
	min-width: 0;
	display: inline-block;
	margin: 0 auto;
	font-size: 18px;
}

#admin-add-form button[type="submit"]:hover,
#admin-add-form button[type="submit"]:focus {
	background: #f5f5f5;
	color: #111;
	border-color: #111;
}

#admin-add-form button[type="submit"]:hover,
#admin-add-form button[type="submit"]:focus {
	background: var(--hover-bg);
	color: var(--primary);
	border-color: var(--primary);
}

.book-item {
	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
	padding-bottom: 8px;
	margin-bottom: 8px;
}

/* Fix Star Rating Layout - Override generic form button styles */
#add-form .star-rating {
	display: flex;
	gap: 4px;
}

#add-form .star {
	width: auto !important;
	min-width: 0 !important;
	background: transparent !important;
	border: none !important;
	padding: 4px !important;
	margin: 0 !important;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: none !important;
	transform: none !important;
}

#add-form .star:hover {
	background: transparent !important;
	transform: scale(1.1) !important;
}

#add-form .star img.star-icon {
	width: 28px;
	height: 28px;
	display: block;
	object-fit: contain;
}

/* Star state filters */
#add-form .star[aria-pressed="false"] img.star-icon {
	filter: grayscale(100%) opacity(0.4);
}

#add-form .star[aria-pressed="true"] img.star-icon {
	filter: none;
}

/* Updated Heart Icon (Request: 32x32, heart-fill 80.svg) */
.btn-icon.fav {
	width: 32px !important;
	height: 32px !important;
	font-size: 0;
	/* Hide text fallback */
	background-image: url('ICON/heart-outline.svg');
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
	border: none !important;
	padding: 0 !important;
}

/* Active State (Filled) using heart-fill 80.svg */
.btn-icon.fav.active,
.card .btn-icon.fav.active {
	background-image: url('ICON/heart-fill 80.svg') !important;
	color: transparent !important;
	/* Hide text heart */
}

/* Hide the text content inside the button since we are using BG image */
/* --- Detail Page Styles (Consolidated from book.html) --- */
.book-wrap {
	max-width: 100%;
	margin: 24px auto;
	background: #fff;
	padding: 24px;
	border-radius: 12px;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.admin-content-box {
	padding: 24px;
	background: #fff;
	border: 1px solid #f0d7df;
	border-radius: 12px;
	box-shadow: 0 4px 15px rgba(240, 215, 223, 0.1);
}

.intro-content {
	display: block;
	transition: max-height 0.3s ease;
	overflow: hidden;
}

.intro-content.expanded {
	display: block !important;
	-webkit-line-clamp: unset !important;
	line-clamp: unset !important;
}

.book-detail-grid {
	display: flex;
	gap: 24px;
	align-items: flex-start;
	position: relative;
}

.book-detail-grid .cover {
	width: 180px;
	height: 250px;
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
	border: 1px solid #eee;
	flex-shrink: 0;
}

.book-detail-grid .cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.book-detail-grid .info-col {
	flex: 1;
	position: relative;
	/* Ensure children can be absolute positioned relative to this */
}

.tags-container {
	display: flex !important;
	flex-wrap: wrap !important;
	gap: 8px !important;
	width: 100% !important;
	box-sizing: border-box !important;
	margin-top: 10px !important;
	align-items: center !important;
	position: relative;
	padding-right: 110px !important;
	/* Space for two horizontally arranged buttons on desktop */
	z-index: 5;
}

.action-buttons-wrap {
	display: flex;
	flex-direction: row;
	/* Horizontal on desktop to fit in tags line */
	align-items: center;
	gap: 12px;
	width: auto;
	position: absolute;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;
}

/* Wrap behavior managed via specificity/media */

#floating-share-btn,
#floating-report-btn {
	position: static !important;
	/* Follow wrapper flex layout */
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: #fff;
	border: 1px solid #eee;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
	cursor: pointer;
	display: flex !important;
	/* Force flex for alignment */
	align-items: center;
	justify-content: center;
	transition: transform 0.2s;
}

/* Redefining tag-badge for a warmer look similar to the old .tag */
.tags-container>a {
	display: flex;
	justify-content: center;
	align-items: center;
	width: auto;
	text-decoration: none;
	min-width: 0;
	/* Important for grid alignment */
}

.tag-badge {
	display: flex;
	justify-content: center;
	align-items: center;

	/* 瘦身：縮小上下 Padding */
	padding: 4px 8px;
	/* Slightly more horizontal padding */

	/* 文字：縮小字體 (12px) 確保四個塞得下，且不換行 */
	font-size: 12px;
	white-space: nowrap;

	/* 視覺：膠囊形狀 */
	border-radius: 999px;
	background-color: #FFF5EB;
	color: #D97706;
	border: 1px solid #FFE0C2;

	/* 確保文字太長時不會撐破網格 */
	min-width: auto;

	width: auto;
	/* Fit text size, not cell width */
	margin: 0;
	transition: background-color 0.2s;
}

.tag-badge:hover {
	background-color: #ffe8cc;
}

/* 3. 針對箭頭按鈕的處理 */
#btn-toggle-tags {
	display: flex !important;
	justify-content: center;
	align-items: center;
	width: 32px !important;
	height: 32px !important;
	margin: 0 !important;
}

/* Force line break for hidden tags */
.tags-flex-break {
	flex-basis: 100% !important;
	height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
}

.comments-section {
	margin-top: 32px;
	border-top: 1px solid rgba(0, 0, 0, 0.06);
	padding-top: 24px;
}

/* Responsive adjustment for Detail Page */
@media (max-width: 600px) {
	.book-detail-grid {
		flex-direction: column;
		align-items: center;
		text-align: center;
	}

	.book-detail-grid .info-col {
		text-align: left !important;
		width: 100%;
	}

	.book-detail-grid .cover {
		width: 160px !important;
		height: 220px !important;
	}

	.tags-container {
		justify-content: flex-start !important;
		padding-right: 0 !important;
		margin-top: 8px !important;
		display: flex !important;
		flex-direction: row !important;
		flex-wrap: wrap !important;
		align-items: center !important;
	}

	.action-buttons-wrap {
		position: static !important;
		display: flex !important;
		flex-direction: row !important;
		/* Row layout for mobile */
		justify-content: flex-end !important;
		margin-top: 5px !important;
		margin-bottom: 10px !important;
		width: 100% !important;
		gap: 12px !important;
		order: -1;
		/* Force it to be the first row in the wrap */
	}

	.add-tag-wrapper {
		order: 10 !important;
	}

	#floating-share-btn,
	#floating-report-btn {
		position: static !important;
		transform: none !important;
		display: flex !important;
	}

	.book-detail-grid .info-col {
		width: 100%;
		padding-right: 0;
	}
}

/* --- Admin Panel Bookmark Tabs --- */
.tab-btn {
	background: #f0f0f0;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-bottom: none;
	padding: 10px 20px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	color: #666;
	border-radius: 8px 8px 0 0;
	transition: all 0.2s;
	outline: none;
}

.tab-btn:hover {
	background: #e8e8e8;
	color: #333;
}

.tab-btn.active {
	background: #fff;
	color: var(--primary);
	border-bottom: 2px solid #fff;
	/* Blend with content box */
	margin-bottom: -1px;
	/* Overlap the border */
	padding-bottom: 11px;
	/* Keep height consistent */
}

.admin-section {
	animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(5px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (max-width: 600px) {
	.admin-tabs {
		flex-wrap: wrap;
		display: flex;
		width: 100%;
	}

	.tab-btn {
		flex: 1 1 30%;
		/* 3 items per row roughly */
		text-align: center;
		padding: 8px 4px !important;
		font-size: 12px !important;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
}

/* --- Detail Page Rating Stars (Read-only) --- */
.detail-rating {
	display: flex;
	gap: 4px;
	margin: 12px 0;
	align-items: center;
}

.detail-rating .star-icon {
	width: 22px;
	height: 22px;
	object-fit: contain;
}

.detail-rating .star-icon.off {
	filter: grayscale(100%) opacity(0.3);
}

.secondary-btn {
	background: #fff;
	color: #FFA94D;
	border: 1px solid #FFA94D;
	padding: 8px 16px;
	border-radius: 8px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	transition: all 0.2s;
}

.secondary-btn:hover {
	background: #FFF4E6;
	color: #FFA94D;
	border-color: #FFA94D;
}

/* --- Interactive Comment Rating Stars --- */
.comment-rating-input {
	display: flex;
	gap: 6px;
	margin-bottom: 12px;
}

.comment-rating-input .star {
	cursor: pointer;
	transition: transform 0.1s;
}

.comment-rating-input .star:hover {
	transform: scale(1.2);
}

.comment-rating-input .star img {
	width: 28px;
	height: 28px;
	filter: grayscale(100%) opacity(0.3);
}

.comment-rating-input .star.active img {
	filter: none;
	opacity: 1;
}

/* --- Rating Breakdown Tooltip --- */
.detail-rating {
	position: relative;
	cursor: default;
}

.rating-breakdown {
	position: absolute;
	top: 100%;
	left: 0;
	background: #fff;
	border: 1px solid #ddd;
	padding: 12px;
	border-radius: 8px;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
	z-index: 100;
	width: 180px;
	display: none;
	margin-top: 8px;
}

.detail-rating:hover .rating-breakdown {
	display: block;
}

.breakdown-row {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	margin-bottom: 4px;
	color: #666;
}

.breakdown-bar-bg {
	flex: 1;
	height: 6px;
	background: #eee;
	border-radius: 3px;
	overflow: hidden;
}

.breakdown-bar-fill {
	height: 100%;
	background: #FFA94D;
	width: 0;
	transition: width 0.5s ease-out;
}

.breakdown-count {
	min-width: 25px;
	text-align: right;
	font-weight: bold;
	color: #333;
}

/* --- Official Platforms Section --- */
.platforms-section {
	margin: 20px 0;
	padding: 24px;
	/* Slightly increased for breathing room */
	background: #fff;
	border-radius: 12px;
	border: 1px solid rgba(0, 0, 0, 0.03);
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.section-title {
	color: #311C20;
	font-size: 18px;
	margin: 0 0 20px 0;
	/* Reset top margin to ensure centered spacing */
	font-weight: 900;
	text-align: center;
	line-height: 1.2;
}

.platforms-grid {
	display: flex;
	gap: 20px;
	justify-content: center;
	flex-wrap: wrap;
	width: 100%;
	padding: 0 10px;
}

.platform-item {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 45px;
	height: 45px;
	border-radius: 8px;
	text-decoration: none;
	transition: transform 0.2s, box-shadow 0.2s;
	overflow: hidden;
	position: relative;
	background: #fff;
	border: 1px solid #eee;
}

.platform-item:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.platform-item img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

/* Component Styles from index.html */
.inline-check {
	display: flex;
	align-items: center;
	gap: 8px;
	white-space: nowrap;
}

.modal-inner {
	max-width: 920px;
	width: 100%;
}

.modal-grid {
	display: flex;
	gap: 20px;
	align-items: flex-start;
}

.star {
	font-size: 22px;
	padding: 6px 8px;
	border-radius: 8px;
	background: transparent;
	border: none;
}

.star img.star-icon {
	width: 24px;
	height: 24px;
	display: block;
}

.star[aria-pressed="true"] img.star-icon {
	filter: none;
}

.star[aria-pressed="false"] img.star-icon {
	filter: grayscale(1) brightness(0.7);
	opacity: 0.6;
}

.tag-input {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	padding: 8px;
	border-radius: 12px;
	background: #fff;
	border: 1px solid #eee;
	width: 100% !important;
	box-sizing: border-box !important;
}

.form-row textarea {
	width: 100% !important;
	box-sizing: border-box !important;
	resize: vertical;
}

.tag-input input {
	border: none;
	outline: none;
	min-width: 120px;
	padding: 6px;
}

.chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: #fff3e6;
	color: #8b5a2b;
	padding: 6px 10px;
	border-radius: 999px;
	font-weight: 600;
	border: 1px solid rgba(0, 0, 0, 0.04);
}

.chip button {
	background: transparent;
	border: none;
	cursor: pointer;
	color: rgba(0, 0, 0, 0.4);
	font-weight: 700;
}


/* Specific styling for platforms that need darker borders */
.platform-item[href*="bookwalker"],
.platform-item[href*="myrenta"] {
	border-color: #ccc;
}

/* Placeholder Style */
.platform-item.placeholder {
	background: #f8f9fa;
	border: 2px dashed #ddd;
	color: #999;
	font-size: 14px;
}

.platform-item.placeholder span {
	pointer-events: none;
}

@media (max-width: 767px) {
	.platforms-grid {
		justify-content: center;
		/* Center the icons, even in last row */
		overflow-x: visible;
		padding-bottom: 20px;
		-webkit-overflow-scrolling: touch;
	}

	.platform-item {
		flex-shrink: 1;
	}

	.categories {
		justify-content: flex-start;
		/* Align category buttons to the left when wrapping */
		flex-wrap: wrap;
		/* Allow wrapping instead of only horizontal scroll if desired */
	}

	/* Hide text and show only icon for btn-add on mobile */
	#btn-add .btn-add-text {
		display: none !important;
	}

	#btn-add .btn-add-icon {
		display: inline !important;
	}

	/* Responsive Header Layout for Phones (< 768px) */
	.site-header .container {
		display: flex !important;
		flex-direction: row !important;
		flex-wrap: wrap !important;
		justify-content: space-between !important;
		align-items: center !important;
		gap: 8px !important;
		padding: 10px 16px !important;
	}

	.brand {
		order: 1 !important;
		margin: 0 !important;
		flex: 1 !important;
		text-align: left !important;
	}

	.controls {
		display: contents !important;
		/* Flatten children for flex ordering */
	}

	/* Action Buttons (Right) */
	#btn-add,
	#btn-account,
	#btn-settings,
	#btn-header-logout {
		order: 2 !important;
		margin-left: 6px !important;
		flex: 0 0 auto !important;
		/* Prevent stretching */
	}

	#btn-add {
		margin-left: auto !important;
		width: 42px !important;
		height: 34px !important;
		font-size: 20px !important;
		padding: 0 !important;
		/* display: flex !important; Removed to allow hiding */
		align-items: center !important;
		justify-content: center !important;
	}

	#btn-account,
	#btn-settings {
		width: 42px !important;
		height: 34px !important;
	}

	/* Search Bar (Below) */
	.controls input {
		order: 3 !important;
		width: 100% !important;
		/* Full width on phones */
		margin: 10px auto 0 auto !important;
		display: block !important;
		height: 38px !important;
		background: #fff !important;
		border: 1px solid #E6D5C3 !important;
		border-radius: 10px !important;
		padding-left: 35px !important;
		background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23311C20" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>') !important;
		background-repeat: no-repeat !important;
		background-position: 10px center !important;
	}
}

.platform-wrapper {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	width: 80px;
	/* Fixed width to ensure equal icon spacing */
}

.platform-name {
	font-size: 13px;
	font-weight: bold;
	color: #555;
	text-align: center;
}

/* Specific overrides for Small Screens (430px and below) */
@media (max-width: 430px) {
	.container {
		padding-left: 12px !important;
		padding-right: 12px !important;
	}

	/* Fluid search for small phones to prevent overflow */
	.controls input {
		width: 100% !important;
		max-width: 364px !important;
	}

	.grid {
		grid-template-columns: repeat(2, 1fr) !important;
		gap: 10px !important;
		width: 100% !important;
	}

	/* Admin RWD Spacing */
	.admin-wrap {
		margin: 10px auto !important;
		padding: 0 10px !important;
		width: 100% !important;
		max-width: 100vw !important;
		box-sizing: border-box !important;
		overflow-x: hidden !important;
	}

	.admin-content-box {
		padding: 12px !important;
		border-radius: 0 0 12px 12px !important;
		width: 100% !important;
		box-sizing: border-box !important;
	}

	/* Admin Form Rows RWD */
	#admin-add-form .link-row {
		flex-direction: column !important;
		gap: 4px !important;
		align-items: stretch !important;
		position: relative;
		padding-bottom: 20px;
		border-bottom: 1px dashed #eee;
		margin-bottom: 15px !important;
	}

	#admin-add-form .link-row input {
		width: 100% !important;
		padding: 6px !important;
		font-size: 14px !important;
		height: 32px !important;
	}

	#admin-add-form .link-row span {
		position: absolute;
		right: 0;
		top: -2px;
		line-height: 1 !important;
		padding: 4px !important;
		z-index: 5;
	}

	/* Admin Lists RWD (Feedback, Users, Books) */
	#feedback-list-container,
	#user-list-container,
	#admin-books-list {
		font-size: 14px !important;
	}

	.feedback-item {
		padding: 12px !important;
		border-bottom: 1px solid #eee !important;
	}

	/* Search Inputs in Admin */
	#admin-search-input,
	#book-search-input,
	#user-search-input,
	#feedback-search-input {
		width: 100% !important;
		margin-bottom: 10px !important;
	}

	.admin-section div:has(h3 + input) {
		flex-direction: column !important;
		align-items: flex-start !important;
	}

	.card .cover {
		height: 200px !important;
	}

	.card .body {
		padding: 12px !important;
	}

	.card h3 {
		font-size: 14px !important;
		margin-bottom: 4px !important;
	}

	.intro-content:not(.expanded) {
		display: -webkit-box !important;
		-webkit-line-clamp: 5 !important;
		line-clamp: 5 !important;
		-webkit-box-orient: vertical !important;
		overflow: hidden !important;
		text-align: left !important;
	}

	/* Strictly enforce Account Button size */
	#btn-account {
		flex: 0 0 42px !important;
		width: 42px !important;
		min-width: 42px !important;
		max-width: 42px !important;
		height: 34px !important;
		padding: 0 !important;
	}

	#btn-settings {
		flex: 0 0 42px !important;
		width: 42px !important;
		height: 34px !important;
	}

	#btn-add {
		flex: 0 0 42px !important;
		width: 42px !important;
		height: 34px !important;
		font-size: 20px !important;
		padding: 0 !important;
	}

	/* Specific Banner Size for Mobile phones - Fluid & Proportional */
	.home-banner,
	.banner-slide,
	.admin-banner-thumb img {
		width: 100% !important;
		max-width: 364px !important;
		height: auto !important;
		/* Allow aspect-ratio to determine height */
		aspect-ratio: 364 / 121 !important;
		margin: 0 auto !important;
		display: block !important;
		border-radius: 8px !important;
	}

	.platforms-section {
		padding: 12px 16px !important;
	}

	#official-platforms {
		width: 100% !important;
		overflow: hidden !important;
	}

	/* Platform styles now handled by the FINAL FIX block at the end of file */
}

/* Specific Fine-tuning for Ultra-Narrow Screens (375px and below) */
@media (max-width: 375px) {
	.container {
		padding-left: 8px !important;
		padding-right: 8px !important;
	}

	.brand {
		font-size: 13px !important;
		gap: 3px !important;
		white-space: nowrap !important;
		display: flex !important;
		align-items: center !important;
	}

	.brand img {
		height: 22px !important;
	}

	#btn-add {
		width: 42px !important;
		height: 34px !important;
		font-size: 20px !important;
		padding: 0 !important;
	}

	#btn-account,
	#btn-settings {
		width: 42px !important;
		height: 34px !important;
	}

	.grid {
		gap: 8px !important;
	}
}

.platforms-section {
	margin: 10px 0 !important;
}

.platforms-section .section-title {
	margin: 0 0 10px 0 !important;
	font-size: 16px !important;
}

.banner {
	padding: 8px 12px !important;
}

/* iPad/Tablet Scrolling Fix - Aggressive */
@media screen and (min-width: 768px) and (max-width: 1180px) {

	html,
	body {
		overflow: auto !important;
		overflow-x: hidden !important;
		height: auto !important;
		min-height: 100% !important;
		position: static !important;
		-webkit-overflow-scrolling: touch !important;
	}

	.container {
		padding-left: 16px !important;
		padding-right: 16px !important;
		max-width: 100% !important;
	}

	.site-header .container {
		flex-direction: row !important;
		justify-content: space-between !important;
		align-items: center !important;
		width: 100% !important;
	}

	main {
		overflow: visible !important;
		height: auto !important;
		width: 100% !important;
	}

	.grid {
		width: 100% !important;
		justify-items: center !important;
		grid-template-columns: repeat(5, 1fr) !important;
		gap: 12px !important;
	}

	.card .cover {
		height: 180px !important;
	}

	.card .body {
		padding: 10px !important;
	}

	.card h3 {
		font-size: 14px !important;
	}
}

/* Global Fixes for Book Detail Page (Read More & Tags) */
.intro-content {
	display: -webkit-box !important;
	-webkit-line-clamp: 5 !important;
	line-clamp: 5 !important;
	-webkit-box-orient: vertical !important;
	overflow: hidden !important;
	text-overflow: ellipsis !important;
}

.intro-content.expanded {
	display: block !important;
	-webkit-line-clamp: unset !important;
	line-clamp: unset !important;
	overflow: visible !important;
}



.btn-add-tag {
	background: #f0f0f0;
	border: 1px solid #ddd;
	border-radius: 15px;
	padding: 4px 10px;
	font-size: 14px;
	color: #555;
	cursor: pointer;
	line-height: 1;
	transition: background 0.2s;
}

.btn-add-tag:hover {
	background: #e0e0e0;
}

.add-tag-wrapper {
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
}

.inline-tag-input {
	border: 1px solid #FFA94D;
	border-radius: 15px;
	padding: 4px 8px;
	font-size: 14px;
	outline: none;
	width: 140px;
	color: #555;
	background: #fff;
	height: 30px;
	box-sizing: border-box;
}

.tag-control-btn {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0 4px;
	font-weight: bold;
	font-size: 14px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 30px;
	width: 24px;
}

.tag-confirm {
	color: #FFA94D;
}

.tag-confirm:hover {
	color: #e69542;
}

.tag-cancel {
	color: #999;
}

.platforms-section {
	margin: 10px 0 !important;
}

.platforms-section .section-title {
	margin: 0 0 10px 0 !important;
	font-size: 16px !important;
}

.banner {
	padding: 8px 12px !important;
}

/* iPad/Tablet Scrolling Fix - Aggressive */
@media screen and (min-width: 768px) and (max-width: 1180px) {

	html,
	body {
		overflow: auto !important;
		overflow-x: hidden !important;
		height: auto !important;
		min-height: 100% !important;
		position: static !important;
		-webkit-overflow-scrolling: touch !important;
	}

	.container {
		padding-left: 16px !important;
		padding-right: 16px !important;
		max-width: 100% !important;
	}

	.site-header .container {
		flex-direction: row !important;
		justify-content: space-between !important;
		align-items: center !important;
		width: 100% !important;
	}

	main {
		overflow: visible !important;
		height: auto !important;
		width: 100% !important;
	}

	.grid {
		width: 100% !important;
		justify-items: center !important;
		grid-template-columns: repeat(5, 1fr) !important;
		gap: 12px !important;
	}

	.card .cover {
		height: 180px !important;
	}

	.card .body {
		padding: 10px !important;
	}

	.card h3 {
		font-size: 14px !important;
	}
}

/* Global Fixes for Book Detail Page (Read More & Tags) */
.intro-content {
	display: -webkit-box !important;
	-webkit-line-clamp: 5 !important;
	line-clamp: 5 !important;
	-webkit-box-orient: vertical !important;
	overflow: hidden !important;
	text-overflow: ellipsis !important;
}

.intro-content.expanded {
	display: block !important;
	-webkit-line-clamp: unset !important;
	line-clamp: unset !important;
	overflow: visible !important;
}



.btn-add-tag {
	background: #f0f0f0;
	border: 1px solid #ddd;
	border-radius: 15px;
	padding: 4px 10px;
	font-size: 14px;
	color: #555;
	cursor: pointer;
	line-height: 1;
	transition: background 0.2s;
}

.btn-add-tag:hover {
	background: #e0e0e0;
}

.add-tag-wrapper {
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
}

.inline-tag-input {
	border: 1px solid #FFA94D;
	border-radius: 15px;
	padding: 4px 8px;
	font-size: 14px;
	outline: none;
	width: 140px;
	color: #555;
	background: #fff;
	height: 30px;
	box-sizing: border-box;
}

.tag-control-btn {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0 4px;
	font-weight: bold;
	font-size: 14px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 30px;
	width: 24px;
}

.tag-confirm {
	color: #FFA94D;
}

.tag-confirm:hover {
	color: #e69542;
}

.tag-cancel {
	color: #999;
}

.tag-cancel:hover {
	color: #666;
}

/* FINAL MOBILE FIX: Official Website Horizontal Scroll (3 Items Visible) */
@media (max-width: 768px) {
	#official-platforms {
		display: block !important;
		overflow: visible !important;
		width: 100% !important;
	}

	.platforms-grid {
		display: flex !important;
		flex-wrap: nowrap !important;
		justify-content: flex-start !important;
		gap: 0 !important;
		padding: 10px 0 !important;
		width: 100% !important;
		overflow-x: auto !important;
		overflow-y: hidden !important;
		-webkit-overflow-scrolling: touch !important;
		scroll-snap-type: x mandatory !important;
		scrollbar-width: none !important;
		/* Firefox */
	}

	.platforms-grid::-webkit-scrollbar {
		display: none !important;
		/* Chrome, Safari, Opera */
	}

	.platform-wrapper {
		flex: 0 0 33.33% !important;
		width: 33.33% !important;
		max-width: 33.33% !important;
		display: flex !important;
		flex-direction: column !important;
		align-items: center !important;
		scroll-snap-align: center !important;
	}

	.platform-item {
		width: 50px !important;
		height: 50px !important;
		margin: 0 auto !important;
	}

	.platform-name {
		width: 100% !important;
		text-align: center !important;
		white-space: nowrap !important;
		overflow: hidden !important;
		text-overflow: ellipsis !important;
		padding: 0 4px !important;
	}
}

/* Admin Panel Management RWD */
.banner-row,
.platform-admin-row {
	display: flex;
	gap: 12px;
	align-items: center;
	background: #fff;
	padding: 15px;
	border-radius: 8px;
	border: 1px solid #eee;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
	margin-bottom: 8px;
}

.banner-thumb {
	width: 150px;
	height: 48px;
	background: #f0f0f0;
	border: 1px solid #ddd;
	border-radius: 4px;
	overflow: hidden;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.platform-admin-thumb {
	width: 36px;
	height: 36px;
	background: #fcfcfc;
	border: 1px solid #eee;
	border-radius: 4px;
	overflow: hidden;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.banner-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.platform-admin-thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	padding: 2px;
}

/* Sorting Buttons Style */
.banner-controls,
.platform-admin-order {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-right: 8px;
}

.banner-controls button,
.platform-admin-order button {
	border: 1px solid #ddd;
	background: #f9f9f9;
	padding: 4px 8px;
	cursor: pointer;
	border-radius: 6px;
	font-size: 12px;
	color: #666;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 32px;
	transition: all 0.2s;
}

.banner-controls button:hover,
.platform-admin-order button:hover {
	background: #f0f0f0;
	border-color: #ccc;
}

.banner-controls button:disabled,
.platform-admin-order button:disabled {
	opacity: 0.3;
	cursor: default;
}

.banner-info,
.platform-admin-info {
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1;
}

.platform-edit-btn {
	color: #555;
	background: #f0f0f0;
	border: 1px solid #ddd;
	border-radius: 4px;
	cursor: pointer;
	padding: 0;
	/* Clear padding for better centering */
	width: 40px;
	/* Fixed width for horizontal centering */
	height: 36px;
	font-size: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-left: auto;
	/* Push to the right of the thumb line on mobile before wrapping */
	margin-right: 8px;
	/* Next to delete button */
}

.platform-edit-btn:hover {
	background: #e9e9e9;
}

@media (max-width: 600px) {

	.banner-row,
	.platform-admin-row {
		flex-direction: row;
		flex-wrap: nowrap;
		justify-content: flex-start;
		align-items: center;
		padding: 10px;
		gap: 8px;
		position: relative;
	}

	.banner-row {
		flex-wrap: wrap;
	}

	.banner-thumb {
		width: 100px;
		height: auto;
		aspect-ratio: 3.2 / 1;
		margin: 0 !important;
	}

	.platform-admin-thumb {
		width: 32px;
		height: 32px;
		margin: 0 !important;
		order: 2;
	}

	.banner-controls,
	.platform-admin-order {
		display: flex;
		flex-direction: column !important;
		justify-content: center;
		gap: 4px;
		margin: 0 !important;
		order: 1;
	}

	.banner-info,
	.platform-admin-info {
		flex: 1;
		min-width: 0;
		margin: 0 !important;
		text-align: left;
		order: 3;
	}

	.platform-admin-info div {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		font-size: 14px;
	}

	.platform-admin-info a {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		display: block;
		font-size: 11px;
	}

	.platform-edit-btn {
		margin: 0 !important;
		order: 4;
		flex-shrink: 0;
		width: 32px;
		height: 32px;
	}

	.banner-row .delete-banner-btn {
		position: absolute;
		right: 4px;
		top: 4px;
		padding: 4px !important;
		font-size: 18px !important;
	}

	.platform-admin-row .delete-platform-btn {
		position: static !important;
		/* Move it inline with the pencil button */
		margin-left: 4px;
		padding: 4px !important;
		font-size: 18px !important;
		order: 5;
	}
}

/* Email Masking with Candy */
.email-display {
	position: relative;
	display: inline-block;
}

.email-display.masked {
	color: transparent !important;
}

.email-display.masked::after {
	content: '';
	position: absolute;
	left: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 100%;
	height: 16px;
	background-color: #FFA94D;
	/* Updated color as requested */
	mask: url('ICON/Candy.svg') repeat-x center / contain;
	-webkit-mask: url('ICON/Candy.svg') repeat-x center / contain;
}