/* ==========================================================================
   neo.css — หน้าแรกโฉมใหม่ (แนว C+A : Dense Grid)
   ไม่พึ่ง Bootstrap / FontAwesome โหลดเดี่ยว ๆ ได้เลย
   สีหลักรับค่าจาก setting ของ admin ผ่าน --accent ที่ header ฉีดมาให้
   ========================================================================== */

/* --------------------------------------------------------------- ฟอนต์ ---
   เก็บไฟล์ไว้บนเซิร์ฟเวอร์เอง ไม่ดึงจาก Google เพราะ
     1. ไม่ต้องต่อไปอีกโดเมนก่อนตัวอักษรจะขึ้น ตัวอักษรมาพร้อม CSS เลย
     2. ไม่ส่ง IP ของคนเข้าเว็บไปให้บุคคลที่สาม

   unicode-range ทำให้เบราว์เซอร์โหลดเฉพาะชุดที่หน้านั้นใช้จริง
   หน้าภาษาไทยล้วนจะไม่โหลดไฟล์ละตินมาให้เปลืองเลย

   Anuphan เป็น variable font ไฟล์เดียวครอบคลุมน้ำหนัก 400–600
   ส่วน Bai Jamjuree เป็นไฟล์แยกตามน้ำหนัก
   ทั้งคู่เป็นฟอนต์เปิดภายใต้ SIL Open Font License
   -------------------------------------------------------------------------- */

@font-face {
	font-family: "Anuphan";
	font-style: normal;
	font-weight: 400 600;
	font-display: swap;
	src: url("../fonts/anuphan-var-thai.woff2") format("woff2");
	unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
	font-family: "Anuphan";
	font-style: normal;
	font-weight: 400 600;
	font-display: swap;
	src: url("../fonts/anuphan-var-latin.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Bai Jamjuree";
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url("../fonts/bai-jamjuree-600-thai.woff2") format("woff2");
	unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
	font-family: "Bai Jamjuree";
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url("../fonts/bai-jamjuree-600-latin.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: "Bai Jamjuree";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/bai-jamjuree-700-thai.woff2") format("woff2");
	unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
	font-family: "Bai Jamjuree";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/bai-jamjuree-700-latin.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
	--ink: #14111a;
	--surface: #1d1926;
	--surface-2: #241e30;
	--line: #322a41;
	--line-soft: #262032;
	--text: #ede9f2;
	--muted: #9a93a8;
	--faint: #6b637a;
	--accent: #ff4d6d;
	--accent-soft: rgba(255, 77, 109, .14);
	--amber: #ffc44d;
	--good: #4de0a8;

	/* Anuphan = เนื้อหา ตัวกลมอ่านสบาย · Bai Jamjuree = หัวเรื่อง ตัวเหลี่ยมหนักแน่น
	   ทั้งคู่รองรับไทยเต็มรูปแบบ ต่างจากฟอนต์ระบบที่ทุกอย่างน้ำหนักเดียวกันหมด */
	--font-th: "Anuphan", "Leelawadee UI", "Noto Sans Thai", system-ui, sans-serif;
	--font-dis: "Bai Jamjuree", "Anuphan", "Leelawadee UI", system-ui, sans-serif;
	--font-mono: "Cascadia Mono", "SF Mono", ui-monospace, monospace;

	--rail: 176px;
	--gap: 26px;
	--pad: 26px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--ink);
	color: var(--text);
	font-family: var(--font-th);
	font-size: 15px;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}

/* เกรนบาง ๆ ทับทั้งหน้า ความทึบ 3.5% มองไม่เห็นถ้าไม่บอก
   แต่ทำให้พื้นสีเข้มไม่แบนเป็นแผ่นพลาสติก — CSS ล้วน ไม่มีไฟล์เพิ่ม */
body::after {
	content: "";
	position: fixed;
	inset: 0;
	z-index: 999;
	pointer-events: none;
	opacity: .035;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

::selection { background: var(--accent); color: #fff; }

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
	border-radius: 2px;
}

.neo-sr {
	position: absolute;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.neo-wrap {
	max-width: 1680px;
	margin: 0 auto;
	padding: 0 var(--pad);
}

/* ---------- navbar ---------- */

.neo-nav {
	position: sticky;
	top: 0;
	z-index: 40;
	display: flex;
	align-items: center;
	gap: 22px;
	padding: 12px var(--pad);
	background: rgba(20, 17, 26, .92);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--line-soft);
}

.neo-brand {
	flex: none;
	font-family: var(--font-dis);
	font-stretch: 80%;
	font-weight: 700;
	font-size: 19px;
	letter-spacing: .04em;
}
.neo-brand img { max-height: 34px; width: auto; }

.neo-search {
	display: flex;
	align-items: center;
	gap: 9px;
	flex: 1 1 0;
	min-width: 0;          /* ไม่งั้น flex item จะไม่ยอมหดต่ำกว่าความกว้างของ input */
	max-width: 440px;
	padding: 0 14px;
	border: 1px solid var(--line);
	border-radius: 999px;
	transition: border-color .15s;
}
.neo-search:focus-within { border-color: var(--accent); }
.neo-search svg { flex: none; color: var(--faint); }
.neo-search input {
	flex: 1;
	min-width: 0;
	padding: 8px 0;
	border: 0;
	background: none;
	color: var(--text);
	font: inherit;
	font-size: 13.5px;
}
.neo-search input::placeholder { color: var(--faint); }
.neo-search input:focus { outline: none; }
.neo-search button { display: flex; color: var(--faint); padding: 0; }
.neo-search button:hover { color: var(--accent); }

.neo-links {
	display: flex;
	gap: 18px;
	font-size: 13.5px;
	color: var(--muted);
	white-space: nowrap;
}
.neo-links a:hover { color: var(--text); }
.neo-links a.on { color: var(--text); }

.neo-nav-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }

/* เมนูผู้ใช้ — เซิร์ฟเวอร์ส่ง HTML ชุดเดียวกันมาให้ทุกคน (จะได้แคชร่วมกันได้)
   แล้วสคริปต์เล็ก ๆ ใน nav.php ตั้ง data-who ให้ตามคุกกี้
   ค่าเริ่มต้นคือ "out" คนที่ไม่ได้ล็อกอินจึงเห็นถูกตั้งแต่ก่อนสคริปต์ทำงาน
     out   = ยังไม่ล็อกอิน            -> เห็นแค่ "เข้าสู่ระบบ"
     in    = ล็อกอินแล้ว แต่เป็นสมาชิก -> เห็น "ออกจากระบบ"
     staff = เจ้าของหรือทีมงาน        -> เห็น "จัดการเนื้อหา" ด้วย */
.neo-menu [data-who-show] { display: none; }
.neo-menu[data-who="out"]   [data-who-show="out"]   { display: block; }
.neo-menu[data-who="in"]    [data-who-show="in"]    { display: block; }
.neo-menu[data-who="staff"] [data-who-show="in"]    { display: block; }
.neo-menu[data-who="staff"] [data-who-show="staff"] { display: block; }

.neo-avatar {
	width: 30px;
	height: 30px;
	border-radius: 999px;
	object-fit: cover;
	background: var(--surface-2);
	border: 1px solid var(--line);
}

.neo-menu { position: relative; }

.neo-menu-list {
	position: absolute;
	right: 0;
	top: calc(100% + 10px);
	min-width: 172px;
	padding: 6px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 8px;
	box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
	display: none;
	flex-direction: column;
}
.neo-menu-list a {
	padding: 8px 12px;
	border-radius: 5px;
	font-size: 13.5px;
	color: var(--muted);
}
.neo-menu-list a:hover { background: var(--surface-2); color: var(--text); }
.neo-menu-list a.hot { color: var(--good); }
.neo-menu[data-open="1"] .neo-menu-list { display: flex; }

.neo-burger { display: none; padding: 6px; color: var(--muted); }

/* ---------- ประกาศ / โฆษณา ---------- */

.neo-news {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 14px 0 0;
	padding: 11px 14px;
	border: 1px solid var(--line);
	border-left: 3px solid var(--accent);
	border-radius: 4px;
	background: var(--surface);
	font-size: 13.5px;
	color: var(--muted);
}
.neo-news button { margin-left: auto; color: var(--faint); line-height: 1; }
.neo-news button:hover { color: var(--text); }

.neo-ads { margin: 18px 0; text-align: center; }
.neo-ads:empty { display: none; }

/* ---------- แถบอ่านค้างไว้ ---------- */

.neo-resume { margin-top: 22px; }
.neo-resume[hidden] { display: none; }

.neo-resume-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 12px;
}

.neo-resume-card {
	display: grid;
	grid-template-columns: 38px minmax(0, 1fr);
	gap: 11px;
	align-items: center;
	padding: 10px;
	border: 1px solid var(--line-soft);
	border-radius: 6px;
	background: var(--surface);
	transition: border-color .15s, background .15s;
}
.neo-resume-card:hover { border-color: var(--line); background: var(--surface-2); }
.neo-resume-card img {
	width: 38px;
	aspect-ratio: 2 / 3;
	object-fit: cover;
	border-radius: 3px;
	background: var(--surface-2);
}
.neo-resume-card .t {
	font-size: 12.5px;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.neo-resume-card .s { font-size: 11px; color: var(--faint); }
.neo-resume-card .x { margin-left: auto; color: var(--faint); padding: 4px; }
.neo-resume-card .x:hover { color: var(--accent); }

.neo-bar {
	height: 2px;
	margin-top: 5px;
	background: var(--line);
	border-radius: 2px;
	overflow: hidden;
}
.neo-bar i { display: block; height: 100%; background: var(--accent); }

/* ---------- หัวข้อ ---------- */

/* หัวข้อเป็นตัวหนาขนาดจริง ไม่ใช่ตัวพิมพ์ใหญ่เว้นวรรคเท่ากันหมดแบบเดิม
   ซึ่งอ่านยากและไม่มีลำดับความสำคัญ */
.neo-head {
	display: flex;
	align-items: baseline;
	gap: 12px;
	margin: 0 0 20px;
	font-family: var(--font-dis);
	font-size: 19px;
	font-weight: 700;
	letter-spacing: -.01em;
	color: var(--text);
}
.neo-head::after {
	content: "";
	flex: 1;
	height: 1px;
	align-self: center;
	background: linear-gradient(90deg, var(--line), transparent);
}
.neo-head em { font-style: normal; color: var(--faint); font-weight: 400; font-size: 13px; }

/* ---------- โครงหลัก : ฟิลเตอร์ซ้าย + กริดขวา ---------- */

.neo-shell {
	display: grid;
	grid-template-columns: var(--rail) minmax(0, 1fr);
	gap: var(--gap);
	align-items: start;
	margin: 26px 0 40px;
}

.neo-filters {
	position: sticky;
	top: 70px;
	display: flex;
	flex-direction: column;
	gap: 20px;
	max-height: calc(100vh - 90px);
	overflow-y: auto;
	scrollbar-width: thin;
	padding-right: 4px;
}

.neo-fgroup h3 {
	margin: 0 0 9px;
	font-family: var(--font-dis);
	font-stretch: 85%;
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: .18em;
	text-transform: uppercase;
	color: var(--faint);
}

.neo-chips { display: flex; flex-wrap: wrap; gap: 5px; }

.neo-chip {
	padding: 3px 10px;
	border: 1px solid var(--line);
	border-radius: 999px;
	color: var(--muted);
	font-size: 11.5px;
	line-height: 1.55;
	transition: color .13s, border-color .13s, background .13s;
}
.neo-chip:hover { color: var(--text); border-color: var(--faint); }
.neo-chip[aria-pressed="true"] {
	background: var(--accent-soft);
	border-color: var(--accent);
	color: var(--accent);
}

.neo-fsearch {
	width: 100%;
	margin-bottom: 8px;
	padding: 5px 10px;
	border: 1px solid var(--line);
	border-radius: 5px;
	background: var(--ink);
	color: var(--text);
	font: inherit;
	font-size: 11.5px;
}
.neo-fsearch::placeholder { color: var(--faint); }
.neo-fsearch:focus { outline: none; border-color: var(--accent); }

/* พับรายการยาว ๆ ไว้ แต่ตัวที่เลือกอยู่ต้องเห็นเสมอ */
.neo-chips.is-collapsed > .neo-chip:nth-child(n+25):not([aria-pressed="true"]) { display: none; }
.neo-chip[hidden] { display: none; }

.neo-more {
	margin-top: 8px;
	font-size: 11.5px;
	color: var(--faint);
	border-bottom: 1px solid transparent;
}
.neo-more:hover { color: var(--accent); border-bottom-color: var(--accent); }

.neo-live {
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: 11px;
	color: var(--faint);
}
.neo-live .dot {
	width: 5px; height: 5px;
	border-radius: 999px;
	background: var(--good);
	box-shadow: 0 0 0 3px rgba(77, 224, 168, .16);
}

.neo-clear {
	align-self: flex-start;
	font-size: 11.5px;
	color: var(--faint);
	border-bottom: 1px solid transparent;
}
.neo-clear:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- แถบเรียงลำดับ ---------- */

.neo-sort {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 16px;
	font-size: 12.5px;
	color: var(--faint);
	flex-wrap: wrap;
}
.neo-sort button { color: var(--faint); padding: 2px 0; border-bottom: 1px solid transparent; }
.neo-sort button:hover { color: var(--muted); }
.neo-sort button[aria-pressed="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.neo-sort .neo-count { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ---------- กริดหลัก ---------- */

.neo-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
	gap: 20px 12px;
}
.neo-grid.is-busy { opacity: .45; pointer-events: none; transition: opacity .12s; }

.neo-card {
	display: flex;
	flex-direction: column;
	gap: 9px;
	min-width: 0;
	/* ขยับด้วย transform อย่างเดียว ไม่แตะ opacity
	   เพราะถ้าให้แอนิเมชันเป็นตัวเปิดเผยเนื้อหา แล้ววันหนึ่งมันไม่ทำงาน
	   (แท็บพื้นหลัง เบราว์เซอร์หน่วง) การ์ดจะหายถาวร */
	animation: neo-rise .5s cubic-bezier(.22, .8, .3, 1) backwards;
}

@keyframes neo-rise {
	from { transform: translateY(14px); }
	to   { transform: none; }
}

/* ไล่ขึ้นทีละใบ ทีละ 25ms — ทำด้วย CSS ล้วนเพื่อให้ใช้ได้ทั้งการ์ดที่มากับหน้า
   และการ์ดที่ฟิลเตอร์สร้างใหม่ ไม่ต้องพึ่ง JS ไปตั้งค่าให้ทีละใบ */
.neo-card:nth-child(1)  { animation-delay: 0ms; }
.neo-card:nth-child(2)  { animation-delay: 25ms; }
.neo-card:nth-child(3)  { animation-delay: 50ms; }
.neo-card:nth-child(4)  { animation-delay: 75ms; }
.neo-card:nth-child(5)  { animation-delay: 100ms; }
.neo-card:nth-child(6)  { animation-delay: 125ms; }
.neo-card:nth-child(7)  { animation-delay: 150ms; }
.neo-card:nth-child(8)  { animation-delay: 175ms; }
.neo-card:nth-child(9)  { animation-delay: 200ms; }
.neo-card:nth-child(10) { animation-delay: 225ms; }
.neo-card:nth-child(11) { animation-delay: 250ms; }
.neo-card:nth-child(12) { animation-delay: 275ms; }
.neo-card:nth-child(n+13) { animation-delay: 300ms; }

.neo-poster {
	position: relative;
	aspect-ratio: 2 / 3;
	border-radius: 4px;
	overflow: hidden;
	background: var(--surface-2);
	/* เงาสองชั้น — คมใกล้ตัวให้ขอบชัด ฟุ้งไกลตัวให้ลอยอยู่บนพื้น */
	box-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 22px rgba(0, 0, 0, .32);
	transition: transform .32s cubic-bezier(.22, .8, .3, 1), box-shadow .32s;
}
.neo-card:hover .neo-poster {
	transform: translateY(-5px) scale(1.012);
	box-shadow: 0 3px 6px rgba(0, 0, 0, .45), 0 18px 40px rgba(0, 0, 0, .5);
}

.neo-poster img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: opacity .2s;
}

/* สันหนังสือด้านซ้าย ทำให้ปกอ่านเป็นเล่มที่มีความหนา ไม่ใช่รูปสี่เหลี่ยมลอย */
.neo-poster::after {
	content: "";
	position: absolute;
	inset: 0 auto 0 0;
	width: 7px;
	pointer-events: none;
	background: linear-gradient(90deg, rgba(0, 0, 0, .55), rgba(255, 255, 255, .06) 62%, transparent);
}

/* ปกที่โหลดไม่ขึ้น ใช้ลาย screentone แทนกล่องเปล่า */
.neo-poster.is-missing,
.neo-hero-cover.is-missing {
	background:
		radial-gradient(circle, rgba(255, 255, 255, .06) 30%, transparent 32%) 0 0 / 7px 7px,
		linear-gradient(155deg, var(--surface-2), #0c0a10);
}
.neo-poster.is-missing img,
.neo-hero-cover.is-missing img { visibility: hidden; }

.neo-hero-cover.is-missing {
	aspect-ratio: 2 / 3;
	border-radius: 4px;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07);
}

.neo-new {
	position: absolute;
	top: 6px; left: 6px;
	padding: 1px 6px;
	border-radius: 3px;
	background: var(--accent);
	color: #fff;
	font-family: var(--font-dis);
	font-stretch: 85%;
	font-size: 9.5px;
	font-weight: 700;
	letter-spacing: .12em;
}

.neo-title {
	font-size: 12.5px;
	font-weight: 500;
	line-height: 1.4;
	color: var(--text);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	transition: color .18s;
}
.neo-card:hover .neo-title { color: var(--accent); }

/* ชื่อต้นฉบับใต้ชื่อไทย — เป็นข้อมูลประกอบ ไม่ใช่พระเอก
   ตัวพิมพ์ใหญ่เล็ก ๆ กางตัวอักษรออกหน่อย ได้ลุคเหมือนบรรทัดกำกับในนิตยสาร
   ซึ่งอ่านออกว่าเป็นคนละชั้นกับชื่อเรื่องทันทีโดยไม่ต้องใช้สีฉูดฉาด
   บรรทัดเดียวพอ ยาวเกินให้ตัดด้วย … ไม่ปล่อยให้ห่อลงมาหลายบรรทัด */
.neo-sub {
	display: block;
	margin-top: 1px;
	font-family: var(--font-dis);
	font-size: 8.5px;
	font-weight: 600;
	line-height: 1.45;
	letter-spacing: .07em;
	text-transform: uppercase;
	color: var(--faint);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: color .18s;
}
.neo-card:hover .neo-sub { color: var(--muted); }

.neo-meta {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 10.5px;
	color: var(--faint);
	font-variant-numeric: tabular-nums;
}
.neo-meta .star { color: var(--amber); font-weight: 600; }

/* จุดคั่นเล็ก ๆ ระหว่างข้อมูล อ่านง่ายกว่าเว้นวรรคเฉย ๆ */
.neo-meta > span + span::before {
	content: "";
	display: inline-block;
	width: 3px;
	height: 3px;
	margin-right: 8px;
	vertical-align: middle;
	border-radius: 999px;
	background: var(--line);
}

.neo-empty {
	grid-column: 1 / -1;
	padding: 56px 0;
	text-align: center;
	color: var(--faint);
	font-size: 13.5px;
}

/* ---------- แถวยอดนิยม ---------- */

.neo-rail-wrap { margin: 42px 0 0; }

.neo-rail {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 118px;
	gap: 14px;
	overflow-x: auto;
	padding-bottom: 8px;
	scrollbar-width: thin;
	overscroll-behavior-x: contain;
}
.neo-rail .neo-rank {
	font-family: var(--font-dis);
	font-stretch: 85%;
	font-size: 11px;
	color: var(--faint);
	font-variant-numeric: tabular-nums;
}
.neo-rail .neo-rank b { color: var(--accent); font-weight: 700; }

/* ---------- แบ่งหน้า ---------- */

.neo-pager {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 34px 0 0;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}
.neo-pager a, .neo-pager span {
	min-width: 34px;
	padding: 6px 10px;
	text-align: center;
	border: 1px solid var(--line);
	border-radius: 5px;
	color: var(--muted);
}
.neo-pager a:hover { border-color: var(--faint); color: var(--text); }
.neo-pager .on { background: var(--accent); border-color: var(--accent); color: #fff; }
.neo-pager .off { opacity: .35; }

/* ==========================================================================
   หน้าด้านใน
   ========================================================================== */

/* ---------- เส้นทางนำทาง ---------- */

.neo-crumb {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 18px 0 4px;
	font-size: 12px;
	color: var(--faint);
}
.neo-crumb a:hover { color: var(--text); }
.neo-crumb .on { color: var(--muted); }

/* ---------- หัวหน้ารวม ---------- */

.neo-page-head { margin: 14px 0 24px; }

.neo-kind {
	display: block;
	font-family: var(--font-dis);
	font-stretch: 85%;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .2em;
	text-transform: uppercase;
	color: var(--faint);
	margin-bottom: 4px;
}

.neo-page-head h1 {
	margin: 0;
	font-family: var(--font-dis);
	font-stretch: 84%;
	font-weight: 700;
	font-size: clamp(26px, 4vw, 40px);
	line-height: 1.05;
	text-wrap: balance;
}

/* ---------- หัวหน้าเรื่อง ---------- */

.neo-hero {
	display: grid;
	grid-template-columns: 210px minmax(0, 1fr);
	gap: 30px;
	margin: 16px 0 36px;
}

.neo-hero-cover img {
	width: 100%;
	aspect-ratio: 2 / 3;
	object-fit: cover;
	border-radius: 4px;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07), 0 14px 34px rgba(0, 0, 0, .4);
	background: var(--surface-2);
}

.neo-hero-body h1 {
	margin: 0 0 6px;
	font-family: var(--font-dis);
	font-stretch: 84%;
	font-weight: 700;
	font-size: clamp(24px, 3.4vw, 38px);
	line-height: 1.08;
	text-wrap: balance;
}

.neo-hero-alt { margin: 0 0 14px; color: var(--muted); font-size: 14px; }

.neo-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.neo-badge {
	padding: 3px 10px;
	border-radius: 3px;
	background: var(--accent);
	color: #fff;
	font-family: var(--font-dis);
	font-stretch: 86%;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
}
.neo-badge.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.neo-badge.hot { background: var(--amber); color: var(--ink); }

/* สถานะเรื่อง — สีบอกสถานะได้เร็วกว่าอ่านตัวอักษร */
.neo-badge.st-live  { background: var(--good); color: var(--ink); }
.neo-badge.st-done  { background: var(--accent); color: #fff; }
.neo-badge.st-pause { background: var(--amber); color: var(--ink); }
.neo-badge.st-drop  { background: var(--line); color: var(--muted); }

.neo-hero-alts {
	margin: -6px 0 14px;
	font-size: 12px;
	color: var(--faint);
	max-width: 60ch;
}

.neo-hero-stats {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 18px;
	margin-bottom: 20px;
	font-size: 12.5px;
	color: var(--faint);
	font-variant-numeric: tabular-nums;
}

.neo-score b { color: var(--amber); font-weight: 700; font-size: 14px; }
.neo-score i { font-style: normal; color: var(--faint); }

/* ---------- ให้คะแนน ---------- */

.neo-rate {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 20px;
	font-size: 12.5px;
}

.neo-stars { display: flex; gap: 2px; }

.neo-stars button {
	padding: 0 1px;
	font-size: 20px;
	line-height: 1;
	color: var(--line);
	transition: color .1s, transform .1s;
}
.neo-stars button.on { color: var(--amber); }
.neo-stars button:hover { transform: scale(1.15); }

/* ตอนเอาเมาส์ชี้ JS จะใส่ .lit ไล่จากดาวดวงแรกถึงดวงที่ชี้ */
.neo-stars button.lit { color: var(--amber); }

.neo-rate .hint { color: var(--faint); }
.neo-rate.is-saving { opacity: .6; pointer-events: none; }

/* ---------- ปุ่มหลัก ---------- */

.neo-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }

.neo-btn-solid {
	padding: 10px 30px;
	border-radius: 999px;
	background: var(--accent);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	transition: filter .15s;
}
.neo-btn-solid:hover { filter: brightness(1.12); }

/* ---------- เรื่องย่อ ---------- */

.neo-synopsis { position: relative; margin-bottom: 24px; max-width: 68ch; }

.neo-synopsis p {
	margin: 0;
	font-size: 13.5px;
	line-height: 1.75;
	color: var(--muted);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.neo-synopsis[data-open="1"] p { -webkit-line-clamp: unset; display: block; }

.neo-synopsis button {
	margin-top: 6px;
	font-size: 12.5px;
	color: var(--accent);
	border-bottom: 1px solid transparent;
}
.neo-synopsis button:hover { border-bottom-color: var(--accent); }

.neo-facts { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.neo-facts > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; }
.neo-facts dt {
	font-family: var(--font-dis);
	font-stretch: 85%;
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--faint);
	padding-top: 5px;
}
.neo-facts dd { margin: 0; display: flex; flex-wrap: wrap; gap: 5px; }

.neo-tag {
	padding: 3px 11px;
	border: 1px solid var(--line);
	border-radius: 999px;
	font-size: 12px;
	color: var(--muted);
	transition: color .13s, border-color .13s, background .13s;
}
.neo-tag:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.neo-muted { color: var(--faint); }

/* ---------- รายการตอน ---------- */

.neo-eps { margin: 40px 0 0; }

.neo-ep-list {
	margin: 0;
	padding: 0;
	list-style: none;
	border: 1px solid var(--line-soft);
	border-radius: 6px;
	overflow: hidden;
}
.neo-ep-list li + li { border-top: 1px solid var(--line-soft); }

.neo-ep-list a {
	display: flex;
	align-items: baseline;
	gap: 16px;
	padding: 11px 16px;
	transition: background .13s;
}
.neo-ep-list a:hover { background: var(--surface); }

/* เลขตอน — ชื่อตอนเป็นชื่อไทยของแต่ละเล่ม ไม่ได้บอกลำดับ ต้องมีเลขนำหน้าเสมอ */
.neo-ep-list .n {
	flex: none;
	min-width: 26px;
	font-size: 12px;
	font-weight: 600;
	color: var(--faint);
	font-variant-numeric: tabular-nums;
	text-align: center;
}
.neo-ep-list a:hover .n { color: var(--accent); }
.neo-ep-list li.on .n { color: var(--accent); }

.neo-ep-list .t { flex: 1; min-width: 0; font-size: 13.5px; }
.neo-ep-list a:hover .t { color: var(--accent); }
.neo-ep-list .p {
	flex: none;
	font-size: 11px;
	color: var(--faint);
	font-variant-numeric: tabular-nums;
	padding: 1px 8px;
	border: 1px solid var(--line-soft);
	border-radius: 999px;
}
.neo-ep-list .d { flex: none; font-size: 11.5px; color: var(--faint); min-width: 92px; text-align: right; }

.neo-eps-head { display: flex; align-items: center; gap: 16px; }
.neo-eps-head .neo-head { flex: 1; margin-bottom: 16px; }

.neo-sortlink {
	flex: none;
	margin-bottom: 16px;
	font-size: 12.5px;
	color: var(--muted);
	padding: 4px 12px;
	border: 1px solid var(--line);
	border-radius: 999px;
	white-space: nowrap;
}
.neo-sortlink:hover { border-color: var(--accent); color: var(--accent); }

.neo-ep-list.is-compact { max-height: 340px; overflow-y: auto; scrollbar-width: thin; }
.neo-ep-list li.on { background: var(--accent-soft); }
.neo-ep-list li.on .t { color: var(--accent); }

/* ==========================================================================
   ตัวอ่านแบบ "จมไปกับเรื่อง"
   ตอนอ่านทุกอย่างหายหมด เหลือแค่เส้นความคืบหน้า
   ========================================================================== */

.neo-reader { position: relative; margin: 0 0 30px; }

/* เส้นความคืบหน้า — อยู่ตลอด ไม่หายไปพร้อมแถบอื่น */
.neo-progress {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 2px;
	z-index: 45;
	background: rgba(255, 255, 255, .06);
	pointer-events: none;
}
.neo-progress i {
	display: block;
	height: 100%;
	width: 0;
	background: var(--accent);
	transition: width .1s linear;
}

/* แถบบน ชื่อตอนกับเลขหน้า ซ่อนพร้อมแคปซูลล่าง */
.neo-topfade {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 42;
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 14px 22px 26px;
	background: linear-gradient(rgba(12, 10, 16, .94), transparent);
	transition: opacity .22s, transform .22s;
}

.neo-ep-title {
	margin: 0;
	flex: 1;
	min-width: 0;
	font-family: var(--font-dis);
	font-stretch: 84%;
	font-weight: 700;
	font-size: clamp(15px, 2vw, 21px);
	line-height: 1.15;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.neo-reader-count {
	flex: none;
	font-size: 12.5px;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}
.neo-reader-count b { color: var(--text); font-weight: 600; }

/* ---------- แคปซูลควบคุมลอยล่างจอ ---------- */

.neo-hud {
	position: fixed;
	left: 50%;
	bottom: 20px;
	z-index: 44;
	transform: translateX(-50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	transition: opacity .22s, transform .22s;
}

.neo-hud-main {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 7px 10px;
	border-radius: 999px;
	background: rgba(29, 25, 38, .93);
	border: 1px solid var(--line);
	backdrop-filter: blur(10px);
	box-shadow: 0 14px 36px rgba(0, 0, 0, .5);
}

.neo-hud .hbtn {
	width: 34px;
	height: 34px;
	display: grid;
	place-items: center;
	border-radius: 999px;
	color: var(--muted);
	font-size: 16px;
	line-height: 1;
	transition: background .13s, color .13s;
}
.neo-hud .hbtn:hover { background: var(--surface-2); color: var(--text); }
.neo-hud .hbtn.off { opacity: .25; pointer-events: none; }
.neo-hud .hbtn.gear { font-size: 0; }
.neo-hud .hbtn.gear[aria-expanded="true"] { background: var(--accent); color: #fff; }

.neo-hud .hcount {
	padding: 0 12px;
	font-size: 13px;
	color: var(--text);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}
.neo-hud .hcount i { font-style: normal; color: var(--faint); }

.neo-hud-more {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 8px;
	padding: 9px 12px;
	border-radius: 14px;
	background: rgba(29, 25, 38, .95);
	border: 1px solid var(--line);
	backdrop-filter: blur(10px);
	box-shadow: 0 14px 36px rgba(0, 0, 0, .5);
	order: -1;                       /* ให้กางขึ้นด้านบนของแคปซูล */
}
.neo-hud-more[hidden] { display: none; }

.neo-jump { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.neo-jump input {
	width: 58px;
	padding: 5px 7px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: var(--ink);
	color: var(--text);
	font: inherit;
	font-size: 12.5px;
	text-align: center;
	font-variant-numeric: tabular-nums;
}
.neo-jump input:focus { outline: none; border-color: var(--accent); }

.neo-seg {
	display: flex;
	border: 1px solid var(--line);
	border-radius: 999px;
	overflow: hidden;
}
.neo-seg button {
	padding: 5px 13px;
	font-size: 12px;
	color: var(--muted);
	transition: background .13s, color .13s;
}
.neo-seg button + button { border-left: 1px solid var(--line); }
.neo-seg button:hover { color: var(--text); }
.neo-seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* ---------- ตอนซ่อน ---------- */

.neo-reader[data-chrome="off"] .neo-topfade {
	opacity: 0;
	transform: translateY(-100%);
	pointer-events: none;
}
.neo-reader[data-chrome="off"] .neo-hud {
	opacity: 0;
	transform: translate(-50%, 130%);
	pointer-events: none;
}

.neo-pages {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0;                          /* ไม่มีช่องว่างคั่น หน้าต่อกันเป็นผืนเดียว */
	margin: 0 auto;
	padding-top: 54px;               /* เผื่อที่ให้แถบบนที่ลอยทับอยู่ */
	max-width: var(--reader-w, 860px);
	cursor: pointer;                 /* แตะที่รูปเพื่อเรียก/ซ่อนแถบควบคุม */
}
.neo-pages img {
	width: 100%;
	height: auto;
	display: block;
	background: var(--surface-2);
}

.neo-reader[data-width="narrow"] .neo-pages { --reader-w: 640px; }
.neo-reader[data-width="mid"]    .neo-pages { --reader-w: 860px; }
.neo-reader[data-width="wide"]   .neo-pages { --reader-w: 1200px; }

.neo-pages.is-paged img { display: none; }
.neo-pages.is-paged img.is-current { display: block; cursor: pointer; }

/* หน้าที่ไฟล์รูปหาย — กันไม่ให้ยุบเหลือบรรทัด alt เตี้ย ๆ */
.neo-pages img.is-missing {
	width: 100%;
	aspect-ratio: 2 / 3;
	font-size: 0;
	background:
		radial-gradient(circle, rgba(255, 255, 255, .05) 30%, transparent 32%) 0 0 / 8px 8px,
		linear-gradient(155deg, var(--surface-2), #0c0a10);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05);
}

.neo-btn-ghost {
	padding: 8px 18px;
	border: 1px solid var(--line);
	border-radius: 999px;
	font-size: 13px;
	color: var(--muted);
	transition: color .13s, border-color .13s;
}
.neo-btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.neo-btn-ghost.is-off { opacity: .3; }

/* คำใบ้ครั้งแรก — คนใหม่อาจไม่รู้ว่าปุ่มไปไหน จางหายไปเองหลังใช้งานครั้งแรก */
.neo-kbd-hint {
	margin: 14px auto 0;
	text-align: center;
	font-size: 11.5px;
	color: var(--faint);
	transition: opacity .4s;
}
.neo-kbd-hint.is-gone { opacity: 0; pointer-events: none; }
.neo-kbd-hint kbd {
	display: inline-block;
	padding: 1px 6px;
	border: 1px solid var(--line);
	border-bottom-width: 2px;
	border-radius: 4px;
	font-family: var(--font-mono);
	font-size: 11px;
	color: var(--muted);
}

/* ---------- ไม่พบหน้า ---------- */

.neo-notfound {
	max-width: 46ch;
	margin: 60px auto 90px;
	text-align: center;
}
.neo-notfound h1 {
	margin: 0 0 10px;
	font-family: var(--font-dis);
	font-stretch: 84%;
	font-weight: 700;
	font-size: clamp(26px, 4vw, 38px);
	line-height: 1.1;
}
.neo-notfound p { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.neo-notfound-act { display: flex; gap: 10px; justify-content: center; }

/* ---------- หน้าค้นหา ---------- */

.neo-search-page {
	display: flex;
	align-items: center;
	gap: 18px;
	margin-bottom: 24px;
}

.neo-search--lg { max-width: 560px; padding: 3px 18px; }
.neo-search--lg input { padding: 11px 0; font-size: 15px; }

.neo-grid.is-busy { opacity: .45; pointer-events: none; }

.neo-grid--sm { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }

/* ---------- footer ---------- */

.neo-footer {
	margin-top: 72px;
	padding: 34px 0 46px;
	border-top: 1px solid var(--line-soft);
}

.neo-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 30px; }
.neo-tags a {
	padding: 4px 11px;
	border: 1px solid var(--line-soft);
	border-radius: 999px;
	font-size: 12px;
	color: var(--muted);
}
.neo-tags a:hover { border-color: var(--accent); color: var(--accent); }

.neo-footer-bottom {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 22px;
	align-items: center;
	padding-top: 22px;
	border-top: 1px solid var(--line-soft);
	font-size: 12px;
	color: var(--faint);
}
.neo-footer-bottom nav { display: flex; gap: 18px; }
.neo-footer-bottom nav a:hover { color: var(--text); }
.neo-footer-bottom .c { margin-left: auto; }

/* ---------- modal เข้าสู่ระบบ ---------- */

.neo-modal {
	position: fixed;
	inset: 0;
	z-index: 90;
	display: none;
	place-items: center;
	padding: 20px;
	background: rgba(8, 6, 12, .7);
	backdrop-filter: blur(3px);
}
.neo-modal[data-open="1"] { display: grid; }

.neo-modal-box {
	width: 100%;
	max-width: 340px;
	padding: 28px 26px 24px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 10px;
	box-shadow: 0 26px 60px rgba(0, 0, 0, .55);
}
.neo-modal-box h2 {
	margin: 0 0 20px;
	font-family: var(--font-dis);
	font-stretch: 84%;
	font-size: 22px;
	font-weight: 700;
	text-align: center;
}
.neo-modal-box img { margin: 0 auto 20px; max-height: 46px; width: auto; }

.neo-field { margin-bottom: 11px; }
.neo-field input {
	width: 100%;
	padding: 10px 13px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: var(--ink);
	color: var(--text);
	font: inherit;
	font-size: 13.5px;
}
.neo-field input:focus { outline: none; border-color: var(--accent); }

.neo-btn {
	width: 100%;
	padding: 10px;
	border-radius: 6px;
	background: var(--accent);
	color: #fff;
	font-weight: 600;
	font-size: 14px;
}
.neo-btn:disabled { opacity: .6; cursor: default; }

.neo-msg { margin: 12px 0 0; font-size: 12.5px; text-align: center; min-height: 18px; }
.neo-msg.bad { color: var(--accent); }
.neo-msg.ok { color: var(--good); }

/* ---------- โฆษณาลอยข้าง ---------- */

.neo-adfix { position: fixed; top: 90px; z-index: 30; }
.neo-adfix.l { left: 4px; }
.neo-adfix.r { right: 4px; }
.neo-adfix .close { display: block; text-align: center; font-size: 11px; color: var(--faint); padding: 3px; }
.neo-adfix .close:hover { color: var(--accent); }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
	:root { --rail: 150px; --gap: 18px; --pad: 18px; }
	.neo-links { display: none; }
	.neo-adfix { display: none; }
}

@media (max-width: 780px) {
	.neo-burger { display: block; }
	.neo-shell { grid-template-columns: minmax(0, 1fr); }

	.neo-filters {
		position: fixed;
		inset: 0 auto 0 0;
		z-index: 60;
		width: min(300px, 84vw);
		max-height: none;
		padding: 20px;
		background: var(--surface);
		border-right: 1px solid var(--line);
		transform: translateX(-100%);
		transition: transform .22s ease;
	}
	.neo-filters[data-open="1"] { transform: none; }

	.neo-scrim {
		position: fixed;
		inset: 0;
		z-index: 50;
		background: rgba(8, 6, 12, .6);
		display: none;
	}
	.neo-scrim[data-open="1"] { display: block; }

	.neo-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 16px 9px; }

	.neo-hero { grid-template-columns: 118px minmax(0, 1fr); gap: 18px; }
	.neo-facts > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
	.neo-facts dt { padding-top: 0; }
	.neo-reader-bar { top: 51px; gap: 10px; }
	.neo-ep-title { flex-basis: 100%; }
	.neo-kbd-hint { display: none; }
	.neo-search-page { flex-direction: column; align-items: stretch; gap: 10px; }

	.neo-nav { gap: 10px; padding: 10px 14px; }
	.neo-search { max-width: none; flex: 1 1 60px; }
	.neo-search input { font-size: 12.5px; }
	.neo-brand { font-size: 16px; max-width: 38%; overflow: hidden; }
	.neo-brand img { max-height: 26px; }
	.neo-footer-bottom .c { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; }
	/* ปิดแอนิเมชันแล้วต้องบังคับให้การ์ดมองเห็นได้ ไม่งั้นจะค้างที่ opacity 0 */
	.neo-card { opacity: 1 !important; transform: none !important; }
	.neo-card:hover .neo-poster { transform: none; }
}
