* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	background-color: #121316;
	color: #ffffff;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	min-height: 100vh;
	width: 100vw;
	overflow-x: hidden;
	display: flex;
	flex-direction: column;
}

/* 전체 컨테이너 */
.site-container {
	width: 100%;
	min-height: 100vh;
	padding: 2.5rem 3rem;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
}

/* --- 1. 상단 네비게이션 영역 --- */
.top-nav-container {
	position: relative;
	z-index: 100;
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 100%;
	margin-bottom: 2rem;
	gap: 1.5rem;
}

/* 좌측 카테고리 버튼 바 */
.category-nav {
	display: flex;
	justify-content: flex-start;
	gap: 0.8rem;
	overflow-x: auto;
	-ms-overflow-style: none;
	scrollbar-width: none;
}

.category-nav::-webkit-scrollbar {
	display: none;
}

.category-btn {
	flex: 0 0 auto;
	background-color: #262930;
	color: #a0a5b1;
	border: 1px solid #383c48;
	border-radius: 10px;
	padding: 0.7rem 1.4rem;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	transition: all 0.2s ease;
}

.category-btn:hover {
	background-color: #323742;
	color: #ffffff;
}

.category-btn.active {
	background-color: #38bdf8;
	color: #0f172a;
	border-color: #38bdf8;
	box-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
}

/* 우측 외부 링크 버튼 바 */
.right-nav {
	display: flex;
	align-items: center;
	gap: 0.8rem;
	margin-left: auto;
	position: relative;
}

.right-nav-btn {
	background-color: #262930;
	color: #a0a5b1;
	border: 1px solid #383c48;
	border-radius: 10px;
	padding: 0.7rem 1.2rem;
	font-size: 0.95rem;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	transition: all 0.2s ease;
}

.right-nav-btn:hover {
	background-color: #323742;
	color: #ffffff;
	border-color: #4b5263;
}

.right-nav-btn .arrow {
	font-size: 0.75rem;
	transition: transform 0.2s ease;
}

.witchform-btn {
	background-color: #312e81;
	color: #c7d2fe;
	border-color: #4338ca;
}

.witchform-btn:hover {
	background-color: #3730a3;
	color: #ffffff;
	border-color: #6366f1;
	box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

/* 드롭다운 스타일 (버튼 기준 절대 위치) */
.dropdown {
	position: relative !important;
	display: inline-block;
}

.dropdown-menu {
	display: none;
	position: absolute;
	left: 0 !important;
	right: auto !important;
	top: calc(100% + 0.5rem);
	background-color: #262930;
	border: 1px solid #383c48;
	border-radius: 10px;
	min-width: 140px;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
	z-index: 9999;
	overflow: hidden;
	flex-direction: column;
}

.dropdown.active .dropdown-menu {
	display: flex;
}

.dropdown.active .arrow {
	transform: rotate(180deg);
}

.dropdown-menu a {
	color: #a0a5b1;
	padding: 0.75rem 1.2rem;
	text-decoration: none;
	font-size: 0.9rem;
	font-weight: 500;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	transition: background-color 0.2s, color 0.2s;
}

.dropdown-menu a:hover {
	background-color: #323742;
	color: #38bdf8;
}

/* --- 2. 가로 스크롤 진열장 --- */
.showcase-section {
	width: 100%;
	flex: 1;
	min-height: 600px;
	background-color: #1a1c23;
	border: 1px solid #2e323e;
	border-radius: 16px;
	padding: 2.5rem 2rem;
	display: flex;
	justify-content: center;
	align-items: center;
	position: relative;
	z-index: 1;
}

.showcase-scroll {
	width: 100%;
	display: flex;
	gap: 15rem;
	overflow-x: auto;
	align-items: center;
	justify-content: safe center;
	padding: 1.5rem 1rem;
	-ms-overflow-style: none;
	scrollbar-width: none;
}

.showcase-scroll::-webkit-scrollbar {
	display: none;
}

/* 진열장 네비게이션 화살표 버튼 */
.showcase-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;
	background-color: rgba(26, 28, 35, 0.85);
	color: #ffffff;
	border: 1px solid #3e4454;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	font-size: 1.4rem;
	cursor: pointer;
	display: flex;
	justify-content: center;
	align-items: center;
	transition: all 0.2s ease;
	backdrop-filter: blur(4px);
	opacity: 0;
	pointer-events: none;
}

.showcase-arrow.visible {
	opacity: 1;
	pointer-events: auto;
}

.showcase-arrow:hover {
	background-color: #38bdf8;
	color: #0f172a;
	border-color: #38bdf8;
	box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.showcase-arrow-left {
	left: 1rem;
}

.showcase-arrow-right {
	right: 1rem;
}

/* 개별 아이템 카드 */
.item-card {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	cursor: pointer;
	transition: transform 0.25s ease;
}

.item-card:hover {
	transform: translateY(-10px);
}

/* 표지 이미지 상자 (업로드된 이미지 비율 연동) */
.item-cover-wrapper {
	height: 52vh;
	max-height: 58vh;
	width: auto;
	background-color: #262930;
	border: 2px solid #3e4454;
	border-radius: 14px;
	overflow: hidden;
	display: flex;
	justify-content: center;
	align-items: center;
	margin-bottom: 1.2rem;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.item-cover-wrapper img {
	width: auto;
	height: 100%;
	max-width: 100%;
	object-fit: contain;
}

/* 표지 하단 정보 텍스트 */
.item-info {
	padding: 0 0.3rem;
	text-align: center;
}

.item-title {
	font-size: clamp(1.1rem, 1.3vw, 1.4rem);
	font-weight: bold;
	color: #ffffff;
	margin-bottom: 0.5rem;
}

.item-details {
	font-size: clamp(0.9rem, 1vw, 1.1rem);
	color: #94a3b8;
	line-height: 1.5;
	white-space: pre-line;
}

/* 카테고리 그리드 (단일 카테고리 탭 / 전체 탭 공용) */
.category-grid {
	flex: 0 0 auto;
}

/* 1단(기본): 기존과 동일한 가로 한 줄 배치 */
.category-grid.rows-1 {
	display: flex;
	align-items: center;
	gap: 3rem;
}

/* 2단 / 3단: 세로로 쌓은 뒤 가로로 이어지는 그리드 */
.category-grid.rows-2,
.category-grid.rows-3 {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: max-content;
	align-items: center;
	gap: 1.6rem 2rem;
}

.category-grid.rows-2 {
	grid-template-rows: repeat(2, auto);
}

.category-grid.rows-3 {
	grid-template-rows: repeat(3, auto);
}

/* 다단 그리드 전용 카드 축소 (52vh 기본 카드는 2~3단으로 쌓기엔 너무 큼) */
.category-grid.rows-2 .item-cover-wrapper {
	height: 28vh;
	max-height: 30vh;
}

.category-grid.rows-3 .item-cover-wrapper {
	height: 19vh;
	max-height: 21vh;
}

/* 전체 탭에서 "디바이더 + 그리드"를 하나로 묶는 그룹 (그룹 내부는 좁게, 그룹끼리는 showcase-scroll의 gap으로 넓게) */
.category-group {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 1rem;
}

/* 전체 탭에서 카테고리 구간을 구분하는 세로 디바이더 */
.category-divider {
	flex: 0 0 auto;
	align-self: stretch;
	display: flex;
	align-items: center;
	justify-content: center;
}

.category-divider span {
	writing-mode: vertical-rl;
	text-orientation: mixed;
	font-size: 1.05rem;
	font-weight: 700;
	letter-spacing: 0.2em;
	color: #38bdf8;
	white-space: nowrap;
	padding: 1.4rem 0.7rem;
	border-left: 2px solid rgba(56, 189, 248, 0.6);
}

/* --- 3. 반투명 모달 뷰어 --- */
.modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background-color: rgba(0, 0, 0, 0.85);
	backdrop-filter: blur(8px);
	z-index: 10000;
	display: flex;
	justify-content: center;
	align-items: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
	opacity: 1;
	visibility: visible;
}

.modal-content {
	position: relative;
	width: 92vw;
	height: 92vh;
	background-color: #000000;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
}

.modal-close-btn {
	position: absolute;
	top: 15px;
	left: 15px;
	z-index: 10;
	background: rgba(0, 0, 0, 0.6);
	color: #ffffff;
	border: none;
	font-size: 2.2rem;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	justify-content: center;
	align-items: center;
}

.modal-close-btn:hover {
	background: rgba(255, 255, 255, 0.25);
}

.manga-swiper {
	width: 100%;
	height: 100%;
}

.swiper-slide {
	display: flex;
	justify-content: center;
	align-items: center;
	width: 100%;
	height: 100%;
	will-change: transform;
	transform: translateZ(0);
}

.swiper-slide img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

/* 종이책 중앙 제본선 밀착 정렬 (2페이지 이상 만화책 전용) */
.manga-swiper:not(.single-page)[dir="rtl"] .swiper-slide:nth-child(odd) img {
	object-position: left center;
}
.manga-swiper:not(.single-page)[dir="rtl"] .swiper-slide:nth-child(even) img {
	object-position: right center;
}

.manga-swiper:not(.single-page)[dir="ltr"] .swiper-slide:nth-child(odd) img {
	object-position: right center;
}
.manga-swiper:not(.single-page)[dir="ltr"] .swiper-slide:nth-child(even) img {
	object-position: left center;
}

/* 단면 / 굿즈 뷰어 완전 중앙 정렬 */
.manga-swiper.single-page .swiper-slide {
	display: flex !important;
	justify-content: center !important;
	align-items: center !important;
}

.manga-swiper.single-page .swiper-slide img {
	object-fit: contain !important;
	object-position: center center !important;
	margin: 0 auto !important;
}

.swiper-pagination {
	direction: ltr !important;
}

/* ==========================================
   만화 뷰어 팁 토스트 & 좌우 클릭 면적 (PC + 모바일 공통)
   ========================================== */

/* 읽기 방향 안내 팁 토스트 */
.reader-tip-toast {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background-color: rgba(0, 0, 0, 0.85);
	color: #ffffff;
	padding: 2.5rem 3rem;
	border-radius: 24px;
	font-size: clamp(1.6rem, 4vw, 3rem);
	font-weight: 700;
	line-height: 1.4;
	text-align: center;
	width: 50%;
	max-width: 50vw;
	z-index: 10001;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.3s ease;
	border: 1px solid rgba(255, 255, 255, 0.15);
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.7);
	white-space: normal;
}

.reader-tip-toast.show {
	opacity: 1;
}

/* 좌우 클릭 면적 (15% 넓이, 전체 높이) */
.swiper-button-prev,
.swiper-button-next {
	top: 0 !important;
	bottom: 0 !important;
	height: 100% !important;
	margin-top: 0 !important;
	width: 15% !important;
	min-width: 60px;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	z-index: 100 !important;
	cursor: pointer !important;
	user-select: none;
	pointer-events: auto !important;
}

/* LTR 기본 위치 설정 */
.swiper-button-prev {
	left: 0 !important;
	right: auto !important;
}

.swiper-button-next {
	right: 0 !important;
	left: auto !important;
}

/* RTL 모드 시 위치 정렬: Next(다음페이지/왼쪽방향 <)는 왼쪽, Prev(이전페이지/오른쪽방향 >)는 오른쪽 */
[dir="rtl"] .swiper-button-next,
.manga-swiper[dir="rtl"] .swiper-button-next {
	left: 0 !important;
	right: auto !important;
}

[dir="rtl"] .swiper-button-prev,
.manga-swiper[dir="rtl"] .swiper-button-prev {
	right: 0 !important;
	left: auto !important;
}

/* --- 모바일 대응 (767px 이하) --- */
@media (max-width: 767px) {
	.site-container {
		padding: 1.5rem 1rem;
	}

	.top-nav-container {
		flex-direction: column;
		align-items: stretch;
		gap: 0.8rem;
		margin-bottom: 1.2rem;
	}

	/* 1번째 줄: 상단 카테고리 가로 스크롤 */
	.category-nav {
		width: 100%;
		display: flex;
		justify-content: flex-start;
		gap: 0.5rem;
		overflow-x: auto;
		white-space: nowrap;
		padding-bottom: 4px;
		-webkit-overflow-scrolling: touch;
	}

	.category-btn {
		padding: 0.6rem 1rem;
		font-size: 0.9rem;
	}

	/* 2번째 줄: 작가 및 외부 링크 레이아웃 (드롭다운 잘림 방지를 위해 overflow: visible 지정) */
	.right-nav {
		width: 100%;
		margin-left: 0;
		display: flex;
		justify-content: flex-start;
		gap: 0.5rem;
		overflow: visible !important;
	}

	.right-nav-btn {
		padding: 0.6rem 0.9rem;
		font-size: 0.85rem;
	}

	.dropdown {
		position: relative !important;
		flex: 0 0 auto;
	}

	.dropdown-menu {
		position: absolute;
		top: calc(100% + 0.4rem);
		left: 0 !important;
		right: auto !important;
		min-width: 130px;
		z-index: 9999;
	}

	.showcase-section {
		padding: 1rem 0.5rem;
	}

	.item-cover-wrapper {
		height: 40vh;
	}

	.modal-content {
		width: 98vw;
		height: 90vh;
	}

	.swiper-slide img {
		object-position: center center !important;
	}

	/* 더미 슬라이드 방지 */
	.manga-swiper .swiper-slide.dummy-slide {
		display: none !important;
	}

	/* 마지막 샘플 안내 페이지 단독 중앙 정렬 */
	.manga-swiper .swiper-slide.sample-end-slide {
		width: 100% !important;
		display: flex !important;
		justify-content: center !important;
		align-items: center !important;
	}

	.manga-swiper .swiper-slide.sample-end-slide img {
		object-fit: contain !important;
		object-position: center center !important;
		margin: 0 auto !important;
	}

	/* ==========================================
	   전체 탭 (모바일): 세로 스크롤 + 카테고리별 가로 디바이더
	   각 카테고리 그리드 내부는 가로 스크롤 유지
	   ========================================== */
	.showcase-section.all-tab-mode .showcase-scroll {
		width: 100%;
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
		overflow-x: hidden;
		gap: 9rem;
	}

	.showcase-section.all-tab-mode .category-group {
		flex-direction: column;
		align-items: stretch;
		width: 100%;
		gap: 0.6rem;
	}

	.showcase-section.all-tab-mode .category-divider {
		align-self: auto;
		width: 100%;
	}

	.showcase-section.all-tab-mode .category-divider span {
		writing-mode: horizontal-tb;
		display: block;
		width: 100%;
		border-left: none;
		border-bottom: 2px solid rgba(56, 189, 248, 0.6);
		padding: 0.5rem 0.2rem;
	}

	.showcase-section.all-tab-mode .category-grid {
		width: 100%;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		padding-bottom: 0.4rem;
		-ms-overflow-style: none;
		scrollbar-width: none;
	}

	.showcase-section.all-tab-mode .category-grid::-webkit-scrollbar {
		display: none;
	}

	/* 세로 스크롤 모드에서는 좌우 화살표 버튼이 의미 없으므로 숨김 */
	.showcase-section.all-tab-mode .showcase-arrow {
		display: none !important;
	}

}

