/*
Theme Name: dojinJung
Theme URI: https://dojinjung.com/
Description: ธีมอ่านโดจินของ dojinJung.com — ธีมมืดล้วน สีแบรนด์ชมพูนีออน ภาษาไทย
             ทำงานคู่กับปลั๊กอิน DojinJung Library ซึ่งเป็นเจ้าของ post type และ URL
             รูปทั้งหมดเสิร์ฟจากไฟล์สแตติกนอก WordPress (option `djg_img_base`)
Author: wordpress_auto
Version: 1.0.0
Requires at least: 6.5
Requires PHP: 8.0
Text Domain: dojinjung
*/

/* ซีเอสเอสด้านล่างยกมาจากม็อกอัพที่ Design/dojinjung/assets/style.css ทั้งก้อน
   แก้ที่ม็อกอัพก่อนเสมอ แล้วค่อยซิงก์มาที่นี่ จะได้ไม่หลุดจากกัน
   ส่วนที่เพิ่มเฉพาะ WordPress อยู่ท้ายไฟล์ */

/* ===========================================================================
   dojinJung.com — ม็อกอัพ
   ธีมมืดล้วน พื้นดำอมน้ำเงิน · สีแบรนด์ชมพูนีออน · ภาษาไทย

   สีดูดมาจากเรฟใน ref/ ด้วยการวิเคราะห์พิกเซล ไม่ได้กะเอาเอง
     พื้นหลัง #080e14 · แผง #000000 · ช่องค้นหา #111225 · แถบควบคุม #111520
     ชมพูปุ่ม #f8177f · ชมพูโลโก้ #ff89dd · ชมพูแถวที่เลือก #b71882
     ม่วงพื้นหลังซากุระ #301630 / #3f1b36
   =========================================================================== */

:root {
  /* พื้นผิว */
  --bg:        #080e14;
  --bg2:       #04080d;   /* หัว/ท้าย ที่เข้มกว่าพื้นหน้า */
  --panel:     #000000;   /* แผงไซด์บาร์ */
  --card:      #0c121b;
  --card2:     #111520;   /* แถบควบคุม · ช่องกรอก */
  --field:     #111225;   /* ช่องค้นหาในหัว */
  --line:      #1b2330;
  --line2:     #28313f;

  /* ตัวอักษร */
  --text:      #ffffff;
  --muted:     #a0a8b8;
  --dim:       #6b7382;

  /* สีแบรนด์ */
  --pink:      #f8177f;
  --pink2:     #ff5fb0;
  --pink-soft: #ff89dd;
  --pink-deep: #b71882;
  --pink-bg:   rgba(248, 23, 127, .13);
  --pink-line: rgba(248, 23, 127, .38);
  --grad:      linear-gradient(135deg, #b71882 0%, #f8177f 55%, #ff5fb0 100%);
  --grad-soft: linear-gradient(135deg, rgba(183,24,130,.22), rgba(248,23,127,.12));

  /* สีประจำหมวด (ยกจากไทล์ในเรฟ 01) */
  --c-romance: #e62b87;
  --c-fantasy: #162d57;
  --c-slice:   #2a2340;
  --c-comedy:  #8a5a2b;
  --c-action:  #6b1430;
  --c-drama:   #3b2a6b;
  --c-school:  #1d3a55;
  --c-mystery: #2b2b4a;

  /* สถานะ */
  --gold:      #ffc83d;
  --up:        #34d399;

  /* รูปทรง */
  --r-sm: 9px;
  --r:    14px;
  --r-lg: 18px;
  --r-xl: 24px;

  /* ฟอนต์ */
  --sans:  'Noto Sans Thai', 'Inter', system-ui, sans-serif;
  --head:  'Kanit', 'Noto Sans Thai', sans-serif;
  --hand:  'Caveat', cursive;

  --head-h:   68px;
  --tabbar-h: 62px;
}

/* ── reset ───────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: hidden; scroll-behavior: smooth; }

body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow-x: hidden; max-width: 100%;
}

/* ⚠️ height:auto ต้องมี ห้ามเอาออก
   แอตทริบิวต์ width/height บน <img> ถูกเบราว์เซอร์แปลงเป็น presentational hint
   ซึ่งทับ aspect-ratio ที่ตั้งไว้ใน CSS ถ้าไม่มีบรรทัดนี้ ปกจะสูงตายตัวและยืดผิดส่วน
   (เกิดจริงกับ mi2manga และ doujinsiero มาแล้วทั้งคู่) */
img { max-width: 100%; display: block; height: auto; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4 { margin: 0; font-family: var(--head); font-weight: 600; }

/* inline SVG ไม่มีขนาดในตัว ถ้าไม่กำหนดจะบวมจนดันเลย์เอาต์พัง */
svg { width: 18px; height: 18px; flex: none; }

.sr {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 20px; }

/* กลีบซากุระจาง ๆ เป็นพื้นหลังทั้งหน้า — ไล่เฉดม่วงที่ขอบซ้ายบน/ขวาบน */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 520px at 2% -6%,  rgba(63, 27, 54, .70), transparent 62%),
    radial-gradient(760px 480px at 100% 0%, rgba(48, 22, 48, .55), transparent 60%),
    radial-gradient(620px 420px at 50% 108%, rgba(183, 24, 130, .14), transparent 66%);
}

/* ── ปุ่ม ────────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: 999px; font-size: 14px; font-weight: 600;
  white-space: nowrap; transition: .18s; border: 1px solid transparent;
}
.btn-p { background: var(--grad); color: #fff; box-shadow: 0 6px 20px rgba(248,23,127,.32); }
.btn-p:hover { filter: brightness(1.08); }
.btn-o { background: rgba(255,255,255,.04); border-color: var(--line2); color: #e8eaf0; }
.btn-o:hover { border-color: var(--pink-line); color: #fff; }
.btn-sm { padding: 8px 15px; font-size: 12.5px; }
.btn-ico { padding: 11px; }
.btn svg { width: 16px; height: 16px; }

.ibtn {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.05); border: 1px solid var(--line); color: #cfd4de; transition: .18s;
}
.ibtn:hover { border-color: var(--pink-line); color: #fff; }

/* ── พิลล์ / ชิป ─────────────────────────────────────────────────────────── */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 500;
  background: rgba(255,255,255,.06); border: 1px solid var(--line2); color: #cbd1dd;
}
.pill-p { background: var(--pink-bg); border-color: var(--pink-line); color: var(--pink-soft); }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 999px; font-size: 13px; font-weight: 500;
  background: var(--card2); border: 1px solid var(--line); color: #c3cad6;
  transition: .18s; white-space: nowrap;
}
.chip:hover { border-color: var(--pink-line); color: #fff; }
.chip.on { background: var(--grad); border-color: transparent; color: #fff; }
.chip svg { width: 15px; height: 15px; }
.chip small { opacity: .72; font-size: 11.5px; }

.chips { display: flex; gap: 9px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }

/* ── ส่วนหัว ─────────────────────────────────────────────────────────────── */

.hd {
  position: sticky; top: 0; z-index: 100;
  background: rgba(4, 8, 13, .88); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.hd-in { display: flex; align-items: center; gap: 22px; height: var(--head-h); }

.logo { display: flex; align-items: center; gap: 9px; flex: none; }
.logo .cat {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--grad); box-shadow: 0 4px 14px rgba(248,23,127,.38);
}
.logo .cat svg { width: 21px; height: 21px; color: #fff; }
.logo .tx { font-family: var(--head); font-size: 21px; font-weight: 700; letter-spacing: .2px; line-height: 1; }
.logo .tx i { font-style: normal; color: var(--pink-soft); }
.logo .tx s { text-decoration: none; color: var(--dim); font-size: 15px; font-weight: 500; }

.nav { display: flex; gap: 4px; flex: none; }
.nav a {
  position: relative; padding: 9px 13px; font-size: 14px; color: var(--muted);
  border-radius: var(--r-sm); transition: .18s;
}
.nav a:hover { color: #fff; }
.nav a.on { color: #fff; }
.nav a.on::after {
  content: ''; position: absolute; left: 13px; right: 13px; bottom: 2px; height: 2px;
  border-radius: 2px; background: var(--grad);
}

.search {
  flex: 1; max-width: 420px; margin-left: auto;
  display: flex; align-items: center; gap: 9px;
  background: var(--field); border: 1px solid var(--line); border-radius: 999px;
  padding: 0 14px; height: 40px; transition: .18s;
}
.search:focus-within { border-color: var(--pink-line); }
.search svg { width: 16px; height: 16px; color: var(--dim); }
.search input {
  flex: 1; min-width: 0; background: none; border: 0; outline: none;
  font-size: 13px; color: #fff;
}
.search input::placeholder { color: var(--dim); }
.search kbd {
  font: inherit; font-size: 11px; color: var(--dim);
  padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line2);
}

.hd-r { display: flex; align-items: center; gap: 10px; flex: none; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--pink-line);
}
.burger { display: none; }

/* ── ท้ายเว็บ ────────────────────────────────────────────────────────────── */

.ft { margin-top: 54px; border-top: 1px solid var(--line); background: var(--bg2); }
.ft-in { display: flex; align-items: center; gap: 30px; padding: 26px 0; flex-wrap: wrap; }
.ft .tag {
  font-size: 13px; color: var(--muted); line-height: 1.7; margin: 0;
  padding-left: 30px; border-left: 1px solid var(--line2);
}
.ft .feats { display: flex; gap: 26px; margin-left: auto; flex-wrap: wrap; }
.ft .feat { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--muted); }
.ft .feat svg { width: 18px; height: 18px; color: var(--pink); }
.ft .feat b { display: block; color: #e6e9ef; font-weight: 600; font-size: 12.5px; }

/* ── หัวข้อหมวด ──────────────────────────────────────────────────────────── */

.sec { margin-top: 34px; }
.sec-h { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.sec-h .ic {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--pink-bg); border: 1px solid var(--pink-line); flex: none;
}
.sec-h .ic svg { width: 17px; height: 17px; color: var(--pink-soft); }
.sec-h h2 { font-size: 19px; font-weight: 600; }
.sec-h p { margin: 1px 0 0; font-size: 12.5px; color: var(--dim); }
.sec-h .more {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; color: var(--muted); transition: .18s;
}
.sec-h .more:hover { color: var(--pink-soft); }
.sec-h .more svg { width: 15px; height: 15px; }

/* ── กริด ────────────────────────────────────────────────────────────────── */

.grid { display: grid; gap: 15px; }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ── การ์ดเรื่อง ─────────────────────────────────────────────────────────── */

.card { position: relative; min-width: 0; display: flex; flex-direction: column; }
.card .cv {
  position: relative; display: block; flex: none; overflow: hidden;
  border-radius: var(--r); background: var(--card2);
  border: 1px solid var(--line);
}
.card .cv img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; transition: transform .35s; }
.card:hover .cv img { transform: scale(1.05); }
.card .cv::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 52%, rgba(4,8,13,.88) 100%);
}
.card .t {
  display: block; margin: 10px 2px 0; font-family: var(--sans);
  font-size: 13.5px; font-weight: 600; line-height: 1.35; min-width: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .g { display: flex; gap: 5px; margin: 7px 2px 0; flex-wrap: wrap; }
.card .m {
  display: flex; align-items: center; gap: 12px; margin: 7px 2px 0;
  font-size: 11.5px; color: var(--dim); min-width: 0;
}
.card .m span { display: inline-flex; align-items: center; gap: 4px; }
.card .m svg { width: 13px; height: 13px; }

.badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  padding: 2px 9px; border-radius: 6px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .5px; color: #fff;
}
.badge-new { background: var(--grad); box-shadow: 0 3px 10px rgba(248,23,127,.4); }
.badge-up  { background: linear-gradient(135deg, #7c3aed, #a855f7); }

.ep {
  position: absolute; left: 8px; bottom: 8px; z-index: 2;
  padding: 3px 9px; border-radius: 7px; font-size: 11px; font-weight: 600; color: #fff;
  background: rgba(4,8,13,.78); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.12);
}
.fav {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 29px; height: 29px; border-radius: 9px; display: grid; place-items: center;
  background: rgba(4,8,13,.6); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.14); color: #e8eaf0; transition: .18s;
}
.fav:hover, .fav.on { background: var(--grad); border-color: transparent; color: #fff; }
.fav svg { width: 15px; height: 15px; }

/* แถวเลื่อนแนวนอนบนมือถือ */
.scroll-m { }

/* ── hero (หน้าแรก) ──────────────────────────────────────────────────────── */

.hero { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 15px; margin-top: 20px; }

.hslide {
  position: relative; height: 330px; border-radius: var(--r-xl); overflow: hidden;
  border: 1px solid var(--line);
}
.hslide > img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; }
.hslide::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(95deg, rgba(4,8,13,.96) 0%, rgba(4,8,13,.82) 38%,
                                      rgba(4,8,13,.3) 68%, transparent 100%);
}
.hslide .tx { position: absolute; left: 34px; top: 50%; transform: translateY(-50%); z-index: 2; max-width: 440px; }
.hslide .lb {
  display: inline-block; margin-bottom: 13px; padding: 4px 13px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .5px;
  background: var(--grad); color: #fff;
}
.hslide h1 { font-size: 34px; line-height: 1.18; font-weight: 700; margin-bottom: 12px; }
.hslide .q {
  font-size: 13px; color: #c8cedb; line-height: 1.75; margin: 0 0 20px;
  border-left: 2px solid var(--pink-line); padding-left: 12px;
}
.hslide .ac { display: flex; gap: 10px; flex-wrap: wrap; }
.hdots { position: absolute; left: 34px; bottom: 20px; z-index: 3; display: flex; gap: 6px; }
.hdots i { width: 6px; height: 6px; border-radius: 99px; background: rgba(255,255,255,.3); transition: .22s; cursor: pointer; }
.hdots i.on { width: 20px; background: var(--pink); }
.harrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(4,8,13,.62); border: 1px solid var(--line2); color: #fff; backdrop-filter: blur(8px);
}
.harrow.prev { left: 12px; } .harrow.next { right: 12px; }
.harrow svg { width: 17px; height: 17px; }

.hside { display: grid; grid-template-rows: 1fr 1fr; gap: 15px; min-width: 0; }
.pcard {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--line); display: flex; align-items: flex-end;
}
.pcard > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pcard::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(4,8,13,.35), rgba(4,8,13,.93));
}
.pcard .tx { position: relative; z-index: 2; padding: 16px; }
.pcard .ic { font-size: 19px; margin-bottom: 4px; }
.pcard h3 { font-size: 17px; line-height: 1.25; margin-bottom: 9px; }
.pcard .hand { font-family: var(--hand); font-size: 18px; color: var(--pink-soft); }

/* ── ไทล์หมวดหมู่ ────────────────────────────────────────────────────────── */

.cats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.ctile {
  position: relative; height: 78px; border-radius: var(--r); overflow: hidden;
  display: flex; align-items: center; padding: 15px; border: 1px solid var(--line);
  transition: .2s;
}
.ctile:hover { border-color: var(--pink-line); transform: translateY(-2px); }
.ctile > img {
  position: absolute; right: 0; top: 0; height: 100%; width: 58%; object-fit: cover;
  mask-image: linear-gradient(90deg, transparent, #000 58%);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 58%);
}
.ctile::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--tint, #2a2340) 34%, rgba(8,14,20,.5) 72%, transparent);
}
.ctile .tx { position: relative; z-index: 2; min-width: 0; }
.ctile b { display: block; font-family: var(--head); font-size: 15px; font-weight: 600; }
.ctile small { font-size: 11.5px; color: #d7d9e2; }

/* ── หน้ารวม / สำรวจ ─────────────────────────────────────────────────────── */

.phero {
  position: relative; margin-top: 18px; border-radius: var(--r-xl); overflow: hidden;
  border: 1px solid var(--line); min-height: 132px; display: flex; align-items: center;
}
.phero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 24%; }
.phero::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(4,8,13,.96), rgba(4,8,13,.72) 52%, rgba(4,8,13,.18));
}
.phero .tx { position: relative; z-index: 2; padding: 22px 28px; }
.phero h1 { font-size: 30px; font-weight: 700; }
.phero p { margin: 5px 0 0; font-size: 13px; color: var(--muted); }
.phero .hand {
  position: absolute; right: 36px; top: 50%; transform: translateY(-50%); z-index: 2;
  font-family: var(--hand); font-size: 21px; color: #f3d6ea; text-align: right; line-height: 1.3;
}

.explore { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 18px; margin-top: 18px; align-items: start; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 15px; }
.panel + .panel { margin-top: 14px; }
.panel h4 {
  display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; margin-bottom: 11px;
}
.panel h4 svg { width: 16px; height: 16px; color: var(--pink-soft); }
.panel h4 .more { margin-left: auto; font-size: 11.5px; color: var(--pink-soft); font-weight: 400; }

.flist { display: flex; flex-direction: column; gap: 1px; }
.flist a {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--r-sm);
  font-size: 13px; color: var(--muted); transition: .16s;
}
.flist a:hover { background: rgba(255,255,255,.04); color: #fff; }
.flist a.on { background: var(--grad); color: #fff; font-weight: 500; }
.flist a svg { width: 15px; height: 15px; }
.flist a .n { margin-left: auto; font-size: 11.5px; opacity: .78; }

.checks { display: flex; flex-direction: column; gap: 2px; }
.checks label {
  display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: var(--r-sm);
  font-size: 12.5px; color: var(--muted); cursor: pointer; transition: .16s;
}
.checks label:hover { background: rgba(255,255,255,.04); color: #fff; }
.checks input { accent-color: var(--pink); width: 15px; height: 15px; }
.checks .n { margin-left: auto; font-size: 11.5px; color: var(--dim); }
.checks .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }

.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--card2); border: 1px solid var(--line); border-radius: 999px; padding: 7px;
}
.toolbar .seg { display: flex; gap: 3px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.toolbar .seg::-webkit-scrollbar { display: none; }
.toolbar .seg a {
  padding: 7px 15px; border-radius: 999px; font-size: 13px; color: var(--muted);
  white-space: nowrap; transition: .16s;
}
.toolbar .seg a:hover { color: #fff; }
.toolbar .seg a.on { background: var(--grad); color: #fff; font-weight: 500; }
.toolbar .views { display: flex; gap: 3px; flex: none; }
.toolbar .views button {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  color: var(--dim); transition: .16s;
}
.toolbar .views button.on { background: var(--pink-bg); color: var(--pink-soft); }

.pager { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 26px; }
.pager a, .pager span {
  min-width: 36px; height: 36px; padding: 0 11px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--muted); border: 1px solid var(--line); background: var(--card2);
}
.pager a:hover { border-color: var(--pink-line); color: #fff; }
.pager .on { background: var(--grad); border-color: transparent; color: #fff; font-weight: 600; }
.pager .gap { border: 0; background: none; }

/* ── หน้าเรื่อง ──────────────────────────────────────────────────────────── */

.crumb { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--dim); padding: 16px 0 0; flex-wrap: wrap; }
.crumb a:hover { color: var(--pink-soft); }
.crumb svg { width: 13px; height: 13px; }
.crumb b { color: #e8eaf0; font-weight: 500; }

.shead { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 26px; margin-top: 16px; }
.shead .cv { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line2); }
.shead .cv img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.shead h1 { font-size: 30px; line-height: 1.2; margin: 9px 0 3px; }
.shead .alt { font-size: 14px; color: var(--muted); }
.shead .alt em { font-style: normal; display: block; color: var(--dim); font-size: 13px; }

.stats { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 15px 0; font-size: 13px; color: var(--muted); }
.stats .score { display: flex; align-items: center; gap: 6px; font-size: 20px; font-weight: 700; color: #fff; }
.stats .score svg { width: 19px; height: 19px; color: var(--gold); }
.stats b { color: #e8eaf0; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 18px; font-size: 13px; margin: 14px 0; }
.kv dt { display: flex; align-items: center; gap: 8px; color: var(--dim); }
.kv dt svg { width: 15px; height: 15px; }
.kv dd { margin: 0; color: #e2e6ee; }

.syn { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 17px; margin-top: 16px; }
.syn h3 { font-size: 15px; margin-bottom: 9px; }
.syn p { margin: 0; font-size: 13px; line-height: 1.85; color: var(--muted); }
.syn .more { display: inline-flex; align-items: center; gap: 5px; margin-top: 9px; font-size: 12.5px; color: var(--pink-soft); }

.s2 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; margin-top: 28px; align-items: start; }

.chlist { display: flex; flex-direction: column; gap: 7px; }
.chrow {
  display: flex; align-items: center; gap: 13px; padding: 9px; border-radius: var(--r);
  background: var(--card); border: 1px solid var(--line); transition: .16s;
}
.chrow:hover { border-color: var(--pink-line); }
.chrow img { width: 58px; height: 42px; border-radius: 8px; object-fit: cover; flex: none; }
.chrow .in { flex: 1; min-width: 0; }
.chrow .in b { display: block; font-size: 13.5px; font-weight: 500; }
.chrow .in b .no { color: var(--pink-soft); margin-right: 7px; }
.chrow .d { font-size: 11.5px; color: var(--dim); flex: none; }
.chrow .v { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--dim); flex: none; }
.chrow .v svg { width: 13px; height: 13px; }
.chrow .new { padding: 1px 7px; border-radius: 5px; font-size: 9.5px; font-weight: 700; background: var(--grad); color: #fff; }

.mini { display: flex; flex-direction: column; gap: 9px; }
.mrow { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: var(--r-sm); transition: .16s; }
.mrow:hover { background: rgba(255,255,255,.04); }
.mrow img { width: 52px; height: 70px; border-radius: 8px; object-fit: cover; flex: none; }
.mrow .in { min-width: 0; }
.mrow b { display: block; font-size: 13px; font-weight: 500; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mrow small { display: flex; align-items: center; gap: 10px; margin-top: 4px; font-size: 11.5px; color: var(--dim); }
.mrow small span { display: inline-flex; align-items: center; gap: 4px; }
.mrow small svg { width: 12px; height: 12px; }

/* ── คลังของฉัน ──────────────────────────────────────────────────────────── */

.ltabs {
  display: flex; gap: 4px; margin-top: 18px; background: var(--card2);
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 6px; overflow-x: auto; scrollbar-width: none;
}
.ltabs::-webkit-scrollbar { display: none; }
.ltabs a {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: var(--r);
  font-size: 13.5px; color: var(--muted); white-space: nowrap; transition: .16s;
}
.ltabs a:hover { color: #fff; }
.ltabs a.on { background: var(--grad-soft); border: 1px solid var(--pink-line); color: #fff; font-weight: 500; }
.ltabs a svg { width: 16px; height: 16px; }

.prog { height: 5px; border-radius: 99px; background: rgba(255,255,255,.1); overflow: hidden; margin-top: 8px; }
.prog i { display: block; height: 100%; border-radius: 99px; background: var(--grad); }

.coll {
  position: relative; height: 96px; border-radius: var(--r); overflow: hidden;
  border: 1px solid var(--line); display: flex; align-items: flex-end; padding: 12px;
}
.coll > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.coll::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(4,8,13,.2), rgba(4,8,13,.92)); }
.coll .tx { position: relative; z-index: 2; }
.coll b { display: block; font-size: 13.5px; font-weight: 600; }
.coll small { font-size: 11.5px; color: #cfd4de; }
.coll.add {
  border-style: dashed; border-color: var(--line2); align-items: center; justify-content: center;
  flex-direction: column; gap: 6px; color: var(--muted);
}
.coll.add svg { width: 22px; height: 22px; }

/* ── ค้นหา ───────────────────────────────────────────────────────────────── */

.bigsearch { display: flex; gap: 10px; margin-top: 20px; }
.bigsearch .box {
  flex: 1; display: flex; align-items: center; gap: 11px; min-width: 0;
  background: var(--card2); border: 1px solid var(--pink-line); border-radius: var(--r-lg);
  padding: 0 18px; height: 54px;
}
.bigsearch .box svg { width: 19px; height: 19px; color: var(--pink-soft); }
.bigsearch input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 15px; }
.bigsearch input::placeholder { color: var(--dim); }

.sugg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-top: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.sugg > div { padding: 11px; }
.sugg > div + div { border-left: 1px solid var(--line); }
.sugg h5 { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); font-weight: 500; margin: 0 0 7px; padding: 0 6px; }
.sugg h5 .clear { margin-left: auto; color: var(--pink-soft); }
.sugg a { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--r-sm); font-size: 13px; color: var(--muted); }
.sugg a:hover { background: rgba(255,255,255,.05); color: #fff; }
.sugg a svg { width: 14px; height: 14px; color: var(--dim); }
.sugg a .x { margin-left: auto; color: var(--dim); }

.adv { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; margin-top: 12px; }
.adv-h { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.adv-h h4 { font-size: 14px; color: var(--pink-soft); }
.adv-h .tog { margin-left: auto; font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.adv-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px; }
.adv-grid label { display: block; font-size: 11.5px; color: var(--dim); margin-bottom: 6px; }
.adv-grid select {
  width: 100%; background: var(--card2); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 11px; font-size: 13px; outline: none;
}
.adv-grid select:focus { border-color: var(--pink-line); }

/* ── หน้าอ่าน ────────────────────────────────────────────────────────────── */

.rd { display: grid; grid-template-columns: 250px minmax(0, 1fr) 128px; gap: 16px; margin-top: 16px; align-items: start; }

.rd-side { position: sticky; top: calc(var(--head-h) + 14px); }
.rd-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.rd-head .back { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.rd-info { display: flex; gap: 11px; margin-bottom: 13px; }
.rd-info img { width: 62px; height: 83px; border-radius: 9px; object-fit: cover; flex: none; }
.rd-info b { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; }
.rd-info small { font-size: 11.5px; color: var(--dim); }

.eplist { display: flex; flex-direction: column; gap: 3px; max-height: 420px; overflow-y: auto; }
.eplist a {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: var(--r-sm);
  font-size: 12.5px; color: var(--muted); transition: .16s;
}
.eplist a:hover { background: rgba(255,255,255,.05); color: #fff; }
.eplist a.on { background: var(--grad-soft); border: 1px solid var(--pink-line); color: #fff; }
.eplist .no { color: var(--pink-soft); font-weight: 600; flex: none; }
.eplist .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rd-body { display: flex; flex-direction: column; gap: 3px; }
.rd-body img { width: 100%; border-radius: 4px; }

.rd-thumbs { display: flex; flex-direction: column; gap: 9px; position: sticky; top: calc(var(--head-h) + 14px); max-height: calc(100vh - 110px); overflow-y: auto; }
.rd-thumbs a { position: relative; border-radius: 9px; overflow: hidden; border: 2px solid transparent; }
.rd-thumbs a.on { border-color: var(--pink); }
.rd-thumbs img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.rd-thumbs span { display: block; text-align: center; font-size: 11px; color: var(--dim); margin-top: 3px; }

.rbar {
  position: sticky; bottom: 14px; z-index: 50; margin-top: 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: rgba(17, 21, 32, .94); backdrop-filter: blur(14px);
  border: 1px solid var(--line2); border-radius: 999px; padding: 9px 15px;
}
.rbar .nm { font-size: 13px; color: #e2e6ee; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rbar .nav2 { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.rbar .cnt { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rbar .cnt b { color: var(--pink-soft); }

.rset { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 15px; margin-top: 14px; }
.rset-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.rset label { display: block; font-size: 11.5px; color: var(--dim); margin-bottom: 7px; }
.rset .seg2 { display: flex; gap: 5px; }
.rset .seg2 button {
  flex: 1; padding: 8px 10px; border-radius: var(--r-sm); font-size: 12.5px;
  background: var(--card2); border: 1px solid var(--line); color: var(--muted);
}
.rset .seg2 button.on { background: var(--grad); border-color: transparent; color: #fff; }
.rset input[type=range] { width: 100%; accent-color: var(--pink); }

/* ── ว่างเปล่า ───────────────────────────────────────────────────────────── */

.empty { text-align: center; padding: 48px 20px; }
.empty h2 { font-size: 18px; margin-bottom: 7px; }
.empty p { font-size: 13px; color: var(--muted); margin: 0 0 16px; }

/* ── ประตูยืนยันอายุ ─────────────────────────────────────────────────────── */

.agegate {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  background: rgba(4, 8, 13, .93); backdrop-filter: blur(10px); padding: 20px;
}
.agebox {
  max-width: 430px; width: 100%; text-align: center; padding: 30px 26px;
  background: var(--card); border: 1px solid var(--pink-line); border-radius: var(--r-xl);
  box-shadow: 0 20px 70px rgba(0,0,0,.6);
}
.agebox .logo { justify-content: center; margin-bottom: 16px; }
.agebox h2 { font-size: 19px; margin-bottom: 10px; }
.agebox p { font-size: 13px; color: var(--muted); line-height: 1.8; margin: 0 0 20px; }
.agebox .ac { display: flex; flex-direction: column; gap: 9px; }
.agebox small { display: block; margin-top: 14px; font-size: 11.5px; color: var(--dim); }

/* ── แถบล่างมือถือ ───────────────────────────────────────────────────────── */

.tabbar { display: none; }

/* ── จอแคบ ───────────────────────────────────────────────────────────────── */

@media (max-width: 1200px) {
  .g6 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hside { grid-template-rows: none; grid-template-columns: 1fr 1fr; }
  .pcard { min-height: 128px; }
  .explore { grid-template-columns: 210px minmax(0, 1fr); }
  .s2 { grid-template-columns: minmax(0, 1fr); }
  .rd { grid-template-columns: 220px minmax(0, 1fr); }
  .rd-thumbs { display: none; }
}

@media (max-width: 900px) {
  .nav, .search kbd { display: none; }
  .burger { display: grid; }
  .hd-in { gap: 12px; }
  .search { max-width: none; }
  .g6, .g5 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .g4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .explore { grid-template-columns: minmax(0, 1fr); }
  .explore .panels { display: none; }
  .shead { grid-template-columns: 180px minmax(0, 1fr); gap: 18px; }
  .shead h1 { font-size: 23px; }
  .rd { grid-template-columns: minmax(0, 1fr); }
  .rd-side { display: none; }
  .adv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sugg { grid-template-columns: 1fr; }
  .sugg > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .ft-in { gap: 18px; }
  .ft .tag { padding-left: 0; border-left: 0; }
  .ft .feats { margin-left: 0; gap: 18px; }

  /* แถบล่างมือถือ */
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
    height: var(--tabbar-h);
    background: rgba(4, 8, 13, .97); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; font-size: 10px; color: var(--dim); transition: .16s;
  }
  .tabbar a.on { color: var(--pink-soft); }
  .tabbar svg { width: 20px; height: 20px; }
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  body.reading { padding-bottom: 0; }
  body.reading .tabbar { display: none; }

  /* แถวการ์ดเลื่อนแนวนอนแทนการบีบจนเล็กเกินอ่าน */
  .scroll-m {
    display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none;
    padding-bottom: 4px; scroll-snap-type: x proximity;
  }
  .scroll-m::-webkit-scrollbar { display: none; }
  .scroll-m > * { width: 136px; flex: none; scroll-snap-align: start; }
}

@media (max-width: 560px) {
  .wrap { padding: 0 14px; }
  .g6, .g5, .g4, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hslide { height: 272px; }
  .hslide .tx { left: 20px; right: 20px; max-width: none; }
  .hslide h1 { font-size: 24px; }
  .hside { grid-template-columns: minmax(0, 1fr); }
  .phero h1 { font-size: 22px; }
  .phero .hand { display: none; }
  .shead { grid-template-columns: minmax(0, 1fr); }
  .shead .cv { max-width: 190px; }
  .adv-grid, .rset-grid { grid-template-columns: minmax(0, 1fr); }
  .scroll-m > * { width: 124px; }
  .sec { margin-top: 26px; }
  .sec-h h2 { font-size: 17px; }
}

/* ── แก้หัวเว็บล้นขอบบนมือถือ ─────────────────────────────────────────────
   เดิม .hd-in เป็นแถวเดียวที่มี โลโก้ + ค้นหา + 3 ปุ่มขวา รวมกันกว้างเกิน 390px
   ⚠️ `html{overflow-x:hidden}` บังอาการไว้ — scrollWidth อ่านได้ 375 เหมือนปกติ
      ทั้งที่ปุ่มขวาสุดหลุดออกไปถึง 604px กดไม่ได้เลย
      ต้องวัดด้วย getBoundingClientRect().right เทียบความกว้างจอถึงจะเจอ
   ปุ่มที่ตัดออกไม่ได้หายจากเว็บ — ไปอยู่ในแถบล่างมือถืออยู่แล้ว */

@media (max-width: 900px) {
  .hd-in { gap: 10px; }
  .hd-r .ibtn:first-child { display: none; }   /* กระดิ่งแจ้งเตือน */
  .logo .tx { font-size: 18px; }
  .logo .tx s { display: none; }
}

@media (max-width: 560px) {
  .hd-r { display: none; }                      /* คลังของฉัน + โปรไฟล์ อยู่ในแถบล่างแล้ว */
  .logo .cat { width: 30px; height: 30px; border-radius: 9px; }
  .logo .cat svg { width: 18px; height: 18px; }
  .logo .tx { font-size: 17px; }
  .search { height: 38px; padding: 0 12px; }
  .search input { font-size: 12.5px; }
}
