:root{
  --fd-gold-line: color-mix(in srgb, var(--text-gold) 72%, rgba(255,255,255,0));
  --fd-metallic-gold: #bf953f;
  --fd-diamond-blue: #3da2ff;
}
/* Logo — link home, luxury (no underline) */
a.fd-header-logo-link,
a.fd-header-logo-link:hover,
a.fd-header-logo-link:visited{
  text-decoration:none !important;
  color:inherit;
}
a.fd-header-logo-link:focus-visible{
  outline:2px solid var(--fd-metallic-gold);
  outline-offset:3px;
  border-radius:8px;
}
/* CLS lock — header logo sizing (prevent baseline/width shift) */
a.fd-header-logo-link{
  min-width:320px !important;
  display:inline-flex;
  align-items:center;
}
img.header-logo-img{
  display:block !important;
  width:320px !important;
  height:84px !important;
  aspect-ratio:320/84 !important;
}

/* Best Practices — avatar aspect ratio */
.author-avatar{
  object-fit:cover !important;
}

/* CLS lock — reserve space for genre filter + all stories grid */
.genre-filter-container{
  min-height:60px !important;
}
.ranking-container.all-stories-section{
  min-height:900px !important;
}
/* Guest: ห้ามโชว์โปรไฟล์ / dropdown / โลโก้จิ๋วมุมขวา — ล็อกด้วย state บน body */
body:not(.fd-user-logged-in) #navUserProfile,
body:not(.fd-user-logged-in) #fdHeaderProfileMenu,
body:not(.fd-user-logged-in) #fdHeaderAvatarBtn{
  display:none !important;
  visibility:hidden !important;
  pointer-events:none !important;
}
body.fd-user-logged-in #navUserProfile.fd-nav-user-wrap{
  display:inline-flex !important;
  visibility:visible !important;
  pointer-events:auto !important;
}
/* Header: diamond + avatar cluster — no pill/box (overrides legacy style.css .user-profile) */
#navUserProfile.user-profile,
#navUserProfile.fd-nav-user-wrap{
  border:none !important;
  box-shadow:none !important;
  background:transparent !important;
  padding:0 !important;
  border-radius:0 !important;
  cursor:default;
  gap:8px !important;
}
.fd-nav-user-wrap{
  display:inline-flex !important;
  align-items:center;
  gap:8px;
  position:relative;
}
.fd-nav-user-wrap .nav-user-label,
#navUserProfile .nav-user-label{
  display:inline-flex !important;
  align-items:center;
  flex-wrap:nowrap;
  margin:0;
  padding:0 !important;
  border:none !important;
  background:transparent !important;
  font-family:'Prompt', sans-serif !important;
}
#navUserProfile .fd-nav-username{
  color:var(--fd-metallic-gold) !important;
  font-weight:800 !important;
  -webkit-text-fill-color:var(--fd-metallic-gold);
  font-family:'Prompt', sans-serif !important;
}
#navUserProfile .fd-nav-sep{
  color:var(--fd-metallic-gold) !important;
  font-weight:300;
  opacity:0.9;
  padding:0 4px 0 6px;
  user-select:none;
  font-family:'Prompt', sans-serif !important;
  line-height:1;
}
.fd-header-avatar-wrap{
  position:relative;
  flex:0 0 auto;
}
.fd-header-avatar-btn{
  appearance:none;
  border:none;
  background:transparent;
  padding:0;
  margin:0;
  cursor:pointer;
  border-radius:50%;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  line-height:0;
  min-width:44px;
  min-height:44px;
}
.fd-header-avatar-btn:focus-visible{
  outline:2px solid var(--fd-metallic-gold);
  outline-offset:2px;
}
.fd-header-avatar-btn .header-avatar,
#navUserProfile .header-avatar{
  display:block;
  width:40px;
  height:40px;
  border-radius:50%;
  object-fit:cover;
  margin:0;
  vertical-align:middle;
  border:none !important;
  box-shadow:none !important;
}
.fd-header-profile-menu{
  position:absolute;
  top:calc(100% + 8px);
  right:0;
  left:auto;
  margin-left:0;
  margin-right:0;
  box-sizing:border-box;
  width:276px;
  max-width:min(300px, calc(100vw - 20px));
  min-width:0;
  padding:6px 0 8px;
  margin:0;
  list-style:none;
  border-radius:12px;
  border:1px solid color-mix(in srgb, var(--fd-metallic-gold) 45%, transparent);
  background:linear-gradient(165deg, rgba(22,22,28,0.98) 0%, rgba(4,4,8,0.99) 55%, rgba(12,11,16,0.98) 100%);
  box-shadow:0 18px 44px rgba(0,0,0,0.55), inset 0 1px 0 color-mix(in srgb, var(--fd-metallic-gold) 14%, transparent);
  z-index:400;
  flex-direction:column;
  align-items:stretch;
  gap:1px;
}
.fd-header-menu-prefix{
  display:inline-block;
  margin-right:6px;
  opacity:0.88;
  font-weight:700;
  font-family:'Prompt', sans-serif !important;
  color:color-mix(in srgb, var(--fd-metallic-gold) 70%, #fff);
}
.fd-header-profile-menu-sep{
  height:1px;
  margin:6px 15px 7px;
  background:linear-gradient(90deg, transparent, color-mix(in srgb, var(--fd-metallic-gold) 55%, transparent), transparent);
  flex-shrink:0;
}
.fd-header-profile-menu-footer{
  display:flex;
  justify-content:center;
  align-items:center;
  width:100%;
  box-sizing:border-box;
  padding:2px 15px 10px;
}
.fd-header-profile-menu-footer .fd-header-profile-menu-item--logout{
  width:auto !important;
  min-width:0;
  max-width:100%;
  text-align:center !important;
  padding-left:15px;
  padding-right:15px;
}
.fd-header-profile-menu-item--logout{
  color:#e74c3c !important;
  font-weight:700 !important;
  -webkit-text-fill-color:#e74c3c;
  letter-spacing:0.04em;
  font-family:'Prompt', sans-serif !important;
}
.fd-header-profile-menu-item.fd-header-profile-menu-item--logout:hover,
.fd-header-profile-menu-item.fd-header-profile-menu-item--logout:focus-visible{
  background:rgba(231,76,60,0.12) !important;
  color:#ff6b6b !important;
  -webkit-text-fill-color:#ff6b6b;
}
.fd-header-profile-menu[hidden]{
  display:none !important;
}
.fd-header-profile-menu:not([hidden]){
  display:flex;
}
.fd-header-profile-menu-item{
  appearance:none;
  border:none;
  background:transparent;
  width:100%;
  max-width:100%;
  box-sizing:border-box;
  text-align:left;
  padding:10px 14px;
  font-family:'Prompt', sans-serif !important;
  font-size:14px;
  font-weight:700;
  line-height:1.35;
  color:var(--fd-metallic-gold) !important;
  cursor:pointer;
  letter-spacing:0.02em;
  white-space:nowrap;
}
/* มือถือ/แท็บเล็ต <1024px: ลดความกว้างกล่อง ~30% จาก 236px → 165px ชิดขวา */
@media (max-width: 1023px){
  .fd-header-profile-menu{
    width:165px;
    max-width:min(175px, calc(100vw - 20px));
  }
  .fd-header-profile-menu-item{
    padding:9px 12px;
  }
  .fd-header-profile-menu-sep{
    margin:6px 12px 7px;
  }
  .fd-header-profile-menu-footer{
    padding:2px 12px 10px;
  }
  .fd-header-profile-menu-footer .fd-header-profile-menu-item--logout{
    padding-left:12px;
    padding-right:12px;
  }
}
.fd-header-profile-menu-item:hover,
.fd-header-profile-menu-item:focus-visible{
  background:rgba(191,149,63,0.14);
  color:color-mix(in srgb, var(--fd-metallic-gold) 82%, #ffffff) !important;
}
/* Diamond strip: Desktop = 💎 เลข + คำว่าเพชร (ไม่มี +) | Mobile/Tablet ≤1199px = 💎 เลข + ปุ่ม + (ไม่มีคำว่าเพชร) */
#navUserProfile .fd-nav-diamond{
  display:inline-flex;
  align-items:center;
  gap:6px;
  flex-wrap:nowrap;
  font-family:'Prompt', sans-serif !important;
}
#navUserProfile .fd-nav-diamond-ico{
  color:var(--fd-diamond-blue);
  font-size:16px;
  line-height:1;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}
#navUserProfile .fd-nav-diamond-num{
  color:var(--fd-metallic-gold) !important;
  font-weight:800 !important;
  font-family:'Prompt', sans-serif !important;
  -webkit-text-fill-color:var(--fd-metallic-gold);
  font-size:1em;
  letter-spacing:0.02em;
}
#navUserProfile .fd-nav-diamond-word{
  color:#bf953f !important;
  font-weight:800 !important;
  font-family:'Prompt', sans-serif !important;
  -webkit-text-fill-color:#bf953f;
  font-size:0.92rem;
  letter-spacing:0.04em;
  margin-left:2px;
}
#navUserProfile .fd-nav-diamond-plus{
  appearance:none;
  border:none;
  background:transparent;
  margin:0;
  padding:0 0 0 2px;
  cursor:pointer;
  font-family:'Prompt', sans-serif !important;
  font-weight:800 !important;
  font-size:1.15em;
  line-height:1;
  color:var(--fd-metallic-gold) !important;
  -webkit-text-fill-color:var(--fd-metallic-gold);
  vertical-align:middle;
  flex-shrink:0;
}
#navUserProfile .fd-nav-diamond-plus:hover{
  color:color-mix(in srgb, var(--fd-metallic-gold) 88%, #ffffff) !important;
}
#navUserProfile .fd-nav-diamond-plus:focus-visible{
  outline:2px solid var(--fd-metallic-gold);
  outline-offset:2px;
  border-radius:4px;
}
@media (min-width: 1200px){
  #navUserProfile .fd-nav-diamond-word{
    font-size:0.95rem;
  }
  #navUserProfile .fd-nav-diamond-plus{
    display:none !important;
  }
}
@media (max-width: 1199px){
  #navUserProfile .fd-nav-diamond-word{
    display:none !important;
  }
  #navUserProfile .fd-nav-diamond-plus{
    display:inline-flex !important;
    align-items:center;
    justify-content:center;
  }
}
/* สารบัญ — ตอนฟังฟรี: หูฟังทอง + ข้อความ + เวลา (กลุ่มขวา) */
.chapter-right-cluster--free-listen{
  display:flex !important;
  align-items:center !important;
  justify-content:flex-end !important;
  gap:8px !important;
  flex-wrap:nowrap !important;
  flex-shrink:0 !important;
  font-family:'Prompt', sans-serif !important;
}
.chapter-right-cluster--free-listen .fd-chapter-free-headphone,
.chapter-right-cluster--free-listen .fd-chapter-free-label,
.chapter-right-cluster--free-listen .fd-chapter-free-duration{
  color:var(--fd-metallic-gold) !important;
  font-family:'Prompt', sans-serif !important;
  font-weight:600 !important;
  -webkit-text-fill-color:var(--fd-metallic-gold);
}
.chapter-right-cluster--free-listen .fd-chapter-free-duration{
  font-variant-numeric:tabular-nums !important;
  letter-spacing:0.04em !important;
  font-size:0.82rem !important;
  white-space:nowrap !important;
}
/* Phase 2 overlay — minimalist luxury additions only */

/* Ensure cover image aligns cleanly in slot */
.novel-cover{
  vertical-align: middle !important;
  display: block !important;
  aspect-ratio:250/375 !important;
  object-fit:cover !important;
  background:#1a1a1a !important;
}

/* Ensure views badge anchors to cover wrapper */
.rank-card-hit>div,
.novel-grid-item div[style*="position:relative"]{
  position:relative;
}
/* .fd-cover-aspect เป็นตัวห่อปกจริงใน DOM (มักมีแค่ max-width ใน style) — ต้องเป็น containing block ให้ .fd-views-badge / .finished-badge */
.fd-cover-aspect{
  position:relative;
  display:block;
  overflow:hidden;
}

.fd-views-badge{
  position:absolute !important;
  top:auto !important;
  right:10px !important;
  bottom:12px !important;
  left:auto;
  display:inline-flex;
  width:fit-content;
  align-items:center;
  gap:6px;
  padding:2px 8px;
  border:1px solid color-mix(in srgb, var(--text-gold) 26%, transparent);
  border-radius:999px;
  background:rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow:0 0 0 1px rgba(0,0,0,0.28), 0 12px 30px rgba(0,0,0,0.35);
  color:color-mix(in srgb, var(--text-gold) 78%, #d9d9d9);
  letter-spacing:0.06em;
  line-height:1;
  pointer-events:none;
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
}
.fd-views-badge .fd-views-num{
  color:#D4AF37;
  font-weight:600;
  text-shadow:0 0 6px rgba(212, 175, 55, 0.45), 0 1px 2px rgba(0, 0, 0, 0.85);
}
.fd-views-eye{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:16px;
  height:16px;
  color:var(--text-gold);
}
.fd-eye-svg{
  width:16px;
  height:16px;
  display:block;
}
.fd-eye-svg path,
.fd-eye-svg circle{
  stroke-width:1;
}

.fd-views-badge,
.fd-rating-badge{
  position: absolute !important;
  bottom: 12px !important; /* ค่ามาตรฐานสำหรับหน้าทั่วไป */
  top: auto !important;
  z-index: 100 !important;
}

/* อันดับยอดนิยม — ดึงป้ายขึ้นเล็กน้อยให้เห็นขอบปกด้านล่าง */
.rank-card-hit .fd-views-badge,
.rank-card-hit .fd-rating-badge{
  bottom: 18px !important;
}

.fd-rating-badge{
  position:absolute !important;
  top:auto !important;
  bottom:12px !important;
  left:10px !important;
  right:auto !important;
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:2px 8px;
  border:1px solid rgba(212, 175, 55, 0.5); /* Gold เข้ม */
  border-radius:999px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color:#D4AF37; /* Metallic Gold ที่ชัดเจน */
  font-size:11px;
  font-weight:600;
  z-index:11;
  text-shadow:0 0 8px rgba(212, 175, 55, 0.65), 0 0 2px rgba(0, 0, 0, 0.9);
  pointer-events:none;
}
/* Elegant header search bar */
header .nav-group{
  gap:12px;
  display:flex;
  align-items:center;
  justify-content:flex-end;
}
header .nav-group > nav[aria-label="เมนูหลัก"] a{
  font-weight:700 !important;
  font-family:'Prompt', sans-serif !important;
  color:var(--fd-metallic-gold) !important;
}
#headerSearchToggleBtn.fd-header-search-toggle{
  display:none;
  appearance:none;
  border:none;
  background:transparent;
  color:var(--fd-metallic-gold, #bf953f);
  border-radius:10px;
  min-height:44px;
  min-width:44px;
  width:44px;
  height:44px;
  align-items:center;
  justify-content:center;
  padding:0;
  cursor:pointer;
  flex:0 0 auto;
}
#headerSearchToggleBtn .fd-header-search-toggle-ico{display:inline-flex;align-items:center;justify-content:center;line-height:1}
#headerSearchToggleBtn:hover,
#headerSearchToggleBtn:active{
  background:transparent !important;
}

#headerSearchRow{
  display:none;
}
body.fd-header-search-open #headerSearchRow{
  display:block;
}
#headerSearchSlotDesktop{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  flex:0 0 auto;
}
.header-search-wrap{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:min(420px, 42vw);
  max-width:520px;
}
.header-search-icon{
  position:static;
  width:16px;
  height:16px;
  color:var(--fd-metallic-gold, #bf953f);
  opacity:0.95;
  pointer-events:none;
  flex:0 0 auto;
}
.header-search{
  width:auto;
  flex:1 1 auto;
  height:38px;
  padding:0 14px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--text-gold) 58%, transparent);
  background:rgba(0,0,0,0.28);
  outline:none;
  font-family:'Prompt', sans-serif !important;
  font-size:14px;
  letter-spacing:0.03em;
  color:var(--text-gold) !important;
  -webkit-text-fill-color:var(--text-gold);
  caret-color:var(--text-gold);
  text-overflow:clip !important;
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.35);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}
.header-search::placeholder{
  color:var(--text-gold) !important;
  opacity:0.88;
  font-family:'Prompt', sans-serif !important;
  letter-spacing:0.03em;
  font-size:inherit;
}
.header-search:focus{
  border-color:color-mix(in srgb, var(--text-gold) 86%, transparent);
  box-shadow:0 0 0 1px color-mix(in srgb, var(--text-gold) 26%, transparent), 0 10px 30px rgba(0,0,0,0.35);
}
@media (max-width: 980px){
  .header-search-wrap{
    min-width:min(360px, 46vw);
    max-width:520px;
  }
}

/* Desktop: single-row header, search inline between logo and buttons */
@media (min-width: 1200px){
  header{
    display:flex;
    flex-direction:row;
    justify-content:space-between;
    align-items:center;
    width:100%;
    padding:0 20px;
    box-sizing:border-box;
    gap:24px;
  }
  #headerSearchRow{display:none}
  #headerSearchSlotDesktop{
    display:flex;
    align-items:center;
    justify-content:flex-start;
    flex:0 0 320px;
    width:320px;
    min-width:300px;
    max-width:320px;
    margin:0;
    position:relative;
    z-index:auto;
  }
  /* Fixed luxury slot: wide enough for full Thai placeholder; no overlap with nav */
  #headerSearchSlotDesktop .header-search-wrap{
    width:320px !important;
    min-width:300px !important;
    max-width:320px !important;
    flex:0 0 320px;
    margin:0;
    position:static;
    box-sizing:border-box;
    overflow:visible;
  }
  #headerSearchSlotDesktop .header-search{
    width:100%;
    max-width:100%;
    min-width:0;
    flex:1 1 auto;
    height:36px;
    font-size:11px !important;
    font-family:'Prompt', sans-serif !important;
    color:var(--text-gold) !important;
    box-sizing:border-box;
    text-overflow:clip !important;
  }
  #headerSearchSlotDesktop .header-search::placeholder{
    font-family:'Prompt', sans-serif !important;
    color:var(--text-gold) !important;
    font-size:11px !important;
    opacity:0.9;
  }
  /* Desktop: magnifier — larger + thicker strokes for clarity */
  #headerSearchSlotDesktop .header-search-icon{
    width:20px;
    height:20px;
    min-width:20px;
    min-height:20px;
    opacity:1;
    color:var(--fd-metallic-gold) !important;
  }
  #headerSearchSlotDesktop .header-search-icon svg{
    display:block;
    width:100%;
    height:100%;
  }
  #headerSearchSlotDesktop .header-search-icon circle,
  #headerSearchSlotDesktop .header-search-icon path{
    stroke:currentColor;
    stroke-width:2.35;
    stroke-linecap:round;
    stroke-linejoin:round;
  }
  /* Right group: Search + Home + Diamond + Login — no overlap */
  header .nav-group{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:25px;
    flex:1 1 auto;
    min-width:0;
    flex-wrap:nowrap;
    position:relative;
    z-index:auto;
  }
  header .nav-group nav{
    flex-shrink:0;
    min-width:auto;
    display:flex;
    align-items:center;
    gap:25px;
    white-space:nowrap;
  }
  header .nav-group nav a{
    white-space:nowrap;
    flex-shrink:0;
  }
  header .nav-group #navLoginBtn,
  header .nav-group #navUserProfile{
    flex-shrink:0;
    white-space:nowrap;
  }
  #headerSearchToggleBtn.fd-header-search-toggle{display:none !important;}
}

/* Tablet + Mobile: hide long search, show icon; main nav → profile dropdown */
@media (max-width: 1199px){
  #headerSearchSlotDesktop{display:none !important;}
  #headerSearchToggleBtn.fd-header-search-toggle{display:flex !important;}
  /* Mobile/Tablet: logo must not push icons off-screen */
  a.fd-header-logo-link{
    min-width:0 !important;
    max-width:180px;
    flex:1 1 auto;
  }
  img.header-logo-img{
    width:160px !important;
    height:42px !important;
    aspect-ratio:160/42 !important;
    max-width:100%;
  }
  header .nav-group{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:10px;
    flex-wrap:nowrap;
    min-width:0;
  }
  header .nav-group > nav[aria-label="เมนูหลัก"]{
    display:none !important;
  }
  /* Hide crown + separator; keep 💎 + gold count + gold + */
  #navUserProfile .fd-nav-username,
  #navUserProfile .fd-nav-sep{display:none !important;}
}

/* Mobile: show search bar and force new row */
@media (max-width: 768px){
  /* Row 1: Logo + Diamond + Login/Profile perfectly centered */
  header{
    display:flex;
    flex-direction:row;
    justify-content:space-between;
    align-items:center;
    width:100%;
    height:60px;
    flex-wrap:nowrap;
    gap:12px;
  }
  header .brand-container{
    flex:1 1 auto;
    min-width:0;
  }
  a.fd-header-logo-link{max-width:160px;}
  img.header-logo-img{
    width:150px !important;
    height:39px !important;
    aspect-ratio:150/39 !important;
  }
  header .nav-group{
    flex:0 0 auto;
    display:flex;
    justify-content:flex-end;
    align-items:center;
    gap:10px;
    flex-wrap:nowrap;
    min-width:0;
  }
  header .nav-group > nav[aria-label="เมนูหลัก"],
  header .nav-group #navLoginBtn,
  header .nav-group #navUserProfile{
    flex:0 0 auto;
    white-space:nowrap;
    margin-top:0 !important;
    margin-bottom:0 !important;
    padding-top:0 !important;
    padding-bottom:0 !important;
    align-self:center !important;
  }
  /* Expand Login (mobile); profile cluster stays compact */
  #navLoginBtn{
    align-self:center;
    white-space:nowrap;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    font-size:16px;
    font-weight:600;
    padding:8px 16px;
    min-height:38px;
    border-radius:20px;
    line-height:1;
  }
  /* Legacy style.css hides .nav-user-label on small screens — restore diamond row */
  #navUserProfile .nav-user-label{
    display:inline-flex !important;
    align-items:center;
    gap:4px;
  }
  #navUserProfile .fd-nav-username,
  #navUserProfile .fd-nav-sep{display:none !important;}
  /* Prevent right-edge clipping on small screens */
  header{padding-right:10px;box-sizing:border-box}

  /* Row 2: search lives BELOW header */
  #headerSearchSlotDesktop{display:none}
  #headerSearchRow{width:100%}
  #headerSearchRow .header-search-wrap{
    display:flex;
    align-items:center;
    justify-content:flex-start;
    width:88%;
    max-width:none;
    min-height:36px;
    height:auto;
    margin:10px auto;
    padding:0 12px;
    border-radius:999px;
    border:1px solid color-mix(in srgb, var(--text-gold) 58%, transparent);
    background:rgba(0,0,0,0.28);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.35);
    box-sizing:border-box;
  }
  #headerSearchRow .header-search-icon{width:14px;height:14px}
  #headerSearchRow .header-search{
    flex:1 1 auto;
    width:auto;
    min-width:0;
    height:36px;
    border:none;
    background:transparent;
    backdrop-filter:none;
    -webkit-backdrop-filter:none;
    box-shadow:none;
    padding:0 0 0 6px;
    font-family:'Prompt', sans-serif !important;
    font-size:clamp(9px, 2.65vw, 11px) !important;
    color:var(--text-gold) !important;
    -webkit-text-fill-color:var(--text-gold);
    caret-color:var(--text-gold);
    text-overflow:clip !important;
  }
  #headerSearchRow .header-search::placeholder{
    font-family:'Prompt', sans-serif !important;
    color:var(--text-gold) !important;
    font-size:clamp(9px, 2.65vw, 11px) !important;
    opacity:0.9;
  }
}

/* Search results container: appears without destroying home sections */
#searchResultsContainer{
  display:none;
  opacity:0;
  transform:translateY(-6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  position:relative;
  z-index:50;
  margin:14px auto 0;
  max-width:min(1100px,96vw);
  padding:14px 14px 18px;
  border-radius:18px;
  border:1px solid color-mix(in srgb, var(--text-gold) 22%, transparent);
  background:rgba(0,0,0,0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:0 14px 60px rgba(0,0,0,0.45);
}
body.fd-search-active #searchResultsContainer{
  display:block;
  opacity:1;
  transform:translateY(0);
}
#searchResultsTitle{
  margin:0 0 10px;
  color:var(--text-gold);
  font-family:'Playfair Display', serif;
  letter-spacing:0.08em;
  font-size:1.05rem;
}
#searchResultsGrid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:26px;
  padding:8px 0 0;
}

/* Footer social — Minimalist Luxury (placeholder links) */
.fungdee-footer-social--lux{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:14px;
  margin-top:14px;
}
.fd-social-lux-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:44px;
  height:44px;
  border-radius:50%;
  border:1px solid color-mix(in srgb, var(--text-gold) 42%, transparent);
  background:rgba(0,0,0,0.38);
  color:var(--text-gold);
  text-decoration:none;
  box-shadow:0 0 0 1px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
  transition:transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
}
.fd-social-lux-btn:hover{
  transform:translateY(-2px);
  filter:brightness(1.06);
  box-shadow:0 0 22px color-mix(in srgb, var(--text-gold) 22%, transparent);
}
.fd-social-lux-ico{
  width:20px;
  height:20px;
  display:block;
}

/* Admin — Metallic Stars stats (append-only UI) */
.fd-admin-metallic-stats{
  position:relative;
  margin:22px 0 28px;
  padding:clamp(18px,3vw,28px);
  border-radius:22px;
  overflow:hidden;
  border:1px solid color-mix(in srgb, var(--text-gold) 38%, rgba(255,255,255,0.06));
  background:
    radial-gradient(120% 80% at 10% 0%, rgba(255,215,120,0.14), transparent 52%),
    radial-gradient(90% 70% at 92% 18%, rgba(180,200,255,0.08), transparent 48%),
    linear-gradient(165deg, rgba(18,16,28,0.96), rgba(8,8,14,0.92));
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.45),
    0 24px 60px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.06);
}
.fd-ams-stars-bg{
  pointer-events:none;
  position:absolute;
  inset:0;
  background-image:
    radial-gradient(2px 2px at 12% 22%, rgba(255,236,180,0.9), transparent),
    radial-gradient(1.5px 1.5px at 78% 35%, rgba(200,220,255,0.75), transparent),
    radial-gradient(2px 2px at 44% 68%, rgba(255,210,120,0.55), transparent),
    radial-gradient(1px 1px at 88% 72%, rgba(255,255,255,0.5), transparent);
  opacity:0.55;
  animation:fdAmsTwinkle 5.5s ease-in-out infinite;
}
@keyframes fdAmsTwinkle{
  0%,100%{opacity:0.45;filter:saturate(1);}
  50%{opacity:0.72;filter:saturate(1.15);}
}
.fd-ams-head{
  position:relative;
  text-align:center;
  font-family:'Cinzel','Playfair Display',serif;
  letter-spacing:0.28em;
  font-size:clamp(0.82rem,2.4vw,1rem);
  color:color-mix(in srgb, var(--text-gold) 88%, #fff);
  text-shadow:0 0 22px rgba(241,196,15,0.25);
  margin-bottom:18px;
}
.fd-ams-grid{
  position:relative;
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(160px,1fr));
  gap:14px;
}
.fd-ams-card{
  padding:14px 16px;
  border-radius:16px;
  background:linear-gradient(180deg, rgba(255,255,255,0.06), rgba(0,0,0,0.18));
  border:1px solid color-mix(in srgb, var(--text-gold) 22%, transparent);
  box-shadow:inset 0 1px 0 rgba(255,255,255,0.05);
}
.fd-ams-label{
  font-size:0.78rem;
  letter-spacing:0.06em;
  opacity:0.82;
  color:#c9c9d4;
  margin-bottom:8px;
}
.fd-ams-val{
  font-family:'Playfair Display',serif;
  font-size:clamp(1.35rem,4vw,1.85rem);
  font-weight:700;
  background:linear-gradient(110deg, #fff8e0 0%, #e8c66a 38%, #f5f0ff 72%, #c9b4ff 100%);
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
  filter:drop-shadow(0 1px 8px rgba(0,0,0,0.45));
}
.fd-ams-top{
  position:relative;
  margin-top:20px;
  padding-top:16px;
  border-top:1px solid rgba(255,255,255,0.08);
}
.fd-ams-top-title{
  font-size:0.88rem;
  letter-spacing:0.12em;
  color:var(--text-gold);
  margin-bottom:12px;
  opacity:0.92;
}
.fd-ams-top-list{
  margin:0;
  padding:0 0 0 1.1em;
  list-style:decimal;
  color:#ddd;
  line-height:1.65;
  font-size:0.9rem;
}
.fd-ams-top-list li{
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:10px;
  align-items:baseline;
  padding:6px 0;
  border-bottom:1px dashed rgba(255,255,255,0.06);
}
.fd-ams-rank{
  font-weight:700;
  color:color-mix(in srgb, var(--text-gold) 80%, #fff);
  min-width:1.5em;
}
.fd-ams-nt{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.fd-ams-nn{
  font-variant-numeric:tabular-nums;
  color:#9ad;
  font-size:0.85rem;
}
.fd-ams-muted{
  opacity:0.65;
  font-style:italic;
  list-style:none;
  margin-left:-1em;
}
.fd-ams-refresh{
  position:relative;
  margin-top:16px;
  width:100%;
  padding:10px 14px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--text-gold) 35%, transparent);
  background:rgba(0,0,0,0.35);
  color:var(--text-gold);
  cursor:pointer;
  letter-spacing:0.08em;
  font-size:0.82rem;
  transition:transform 0.2s ease, box-shadow 0.2s ease;
}
.fd-ams-refresh:hover{
  transform:translateY(-1px);
  box-shadow:0 8px 24px rgba(0,0,0,0.4);
}

/* Admin — revenue line chart (Chart.js, metallic gold) */
.fd-ams-chart-wrap{
  position:relative;
  margin-top:22px;
  padding-top:18px;
  border-top:1px solid rgba(255,255,255,0.08);
}
.fd-ams-chart-wrap::before{
  content:'';
  position:absolute;
  left:0;
  right:0;
  top:0;
  height:1px;
  background:linear-gradient(90deg,transparent,rgba(212,175,55,0.35),transparent);
  opacity:0.85;
}
.fd-ams-chart-head{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}
.fd-ams-chart-title{
  font-family:'Cinzel','Playfair Display',serif;
  font-size:clamp(0.82rem,2.2vw,0.95rem);
  letter-spacing:0.14em;
  color:color-mix(in srgb, var(--text-gold) 90%, #fff);
  text-shadow:0 0 18px rgba(241,196,15,0.2);
}
.fd-ams-chart-toggle{
  display:inline-flex;
  gap:6px;
  padding:4px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--text-gold) 28%, transparent);
  background:rgba(0,0,0,0.35);
}
.fd-ams-ctab{
  cursor:pointer;
  border:none;
  border-radius:999px;
  padding:6px 14px;
  font-size:0.72rem;
  letter-spacing:0.06em;
  color:rgba(220,215,200,0.75);
  background:transparent;
  transition:color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.fd-ams-ctab.active{
  color:#1a1408;
  background:linear-gradient(145deg,#fff4d4 0%,#e8c66a 45%,#c9a227 100%);
  box-shadow:0 0 16px rgba(212,175,55,0.35), inset 0 1px 0 rgba(255,255,255,0.45);
}
.fd-ams-ctab:not(.active):hover{
  color:var(--text-gold);
}
.fd-ams-chart-canvas{
  position:relative;
  height:220px;
  width:100%;
  border-radius:16px;
  padding:8px 4px 0;
  background:linear-gradient(180deg, rgba(255,224,160,0.06), rgba(0,0,0,0.15));
  border:1px solid color-mix(in srgb, var(--text-gold) 18%, transparent);
  box-shadow:inset 0 1px 0 rgba(255,255,255,0.04);
}
.fd-ams-chart-canvas canvas{
  max-height:100%;
}

/* Comment send — metallic star sparkle */
#commentList.fd-comment-sparkle{
  position:relative;
  animation:fdCommentBarPulse 0.85s ease-out;
}
@keyframes fdCommentBarPulse{
  0%{box-shadow:0 0 0 0 rgba(241,196,15,0);}
  35%{box-shadow:0 0 28px 2px rgba(241,196,15,0.35);}
  100%{box-shadow:0 0 0 0 rgba(241,196,15,0);}
}
#commentList.fd-comment-sparkle::after{
  content:'✦ ✧ ✦';
  position:absolute;
  right:12px;
  top:-4px;
  font-size:1.1rem;
  letter-spacing:0.35em;
  pointer-events:none;
  background:linear-gradient(120deg,#fff8e0,#f1c40f,#e8e0ff);
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
  animation:fdCommentStarsBlink 0.9s ease-in-out;
  filter:drop-shadow(0 0 6px rgba(241,196,15,0.6));
}
@keyframes fdCommentStarsBlink{
  0%{opacity:0;transform:translateY(6px) scale(0.92);}
  40%{opacity:1;transform:translateY(0) scale(1);}
  100%{opacity:0.85;transform:translateY(-2px) scale(1.02);}
}
@media (prefers-reduced-motion: reduce){
  .fd-ams-stars-bg,#commentList.fd-comment-sparkle,#commentList.fd-comment-sparkle::after{animation:none!important;}
  .fd-ams-chart-canvas canvas{filter:none!important;}
}

/* Footer — payment marks under explore row, centered, clean (no box frame) */
.fd-footer-pay-strip-wrap{
  width:100%;
  margin:10px 0 6px;
  padding:0;
  display:flex;
  justify-content:center;
  align-items:center;
  background:transparent;
  border:none;
  box-shadow:none;
}
.fd-footer-pay-strip{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  align-items:center;
  gap:10px 18px;
}
.fd-footer-pay-logo{
  display:block;
  width:auto;
  max-width:40px;
  max-height:24px;
  height:auto;
  object-fit:contain;
  object-position:center;
  opacity:0.9;
  filter:drop-shadow(0 1px 2px rgba(0,0,0,0.35));
  transition:opacity 0.2s ease;
}
.fd-footer-pay-logo:hover{opacity:1;}
.fd-footer-pay-logo--pp{max-width:40px;max-height:18px;}
.fd-footer-pay-logo--visa{width:40px!important;max-width:40px!important;height:auto;object-fit:contain;object-position:center;}
.fd-username-display{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;}

/* Daily check-in — single white ✓ centered in box (checkin_day 1–7) */
.day-box.checkin-luxury-day{position:relative;}
.day-box.checkin-luxury-day .fd-checkin-tick-char.checkmark{
  display:none;
  position:absolute;
  top:50%;
  left:50%;
  transform:translate(-50%,-50%);
  z-index:2;
  margin:0;
  padding:0;
  line-height:1;
  font-size:1.5rem;
  font-weight:700;
  color:#FFFFFF;
  text-shadow:0 1px 3px rgba(0,0,0,0.65);
  pointer-events:none;
}
.day-box.checkin-luxury-day.checkin-marked .fd-checkin-tick-char.checkmark{display:block!important;visibility:visible!important;opacity:1!important;}

.fd-detail-cover-wrap{position:relative;display:inline-block;max-width:100%;}
.finished-badge{
  position:absolute;top:0;left:0;
  background:linear-gradient(45deg,#FFEFBA,#F5F5F5,#FFEFBA);
  border:2px solid #D4AF37;
  color:#111111;
  font-weight:900;
  padding:6px 16px;
  font-size:14px;
  z-index:50;
  border-bottom-right-radius:12px;
  box-shadow:2px 2px 10px rgba(0,0,0,0.5);
  pointer-events:none;
  text-transform:uppercase;
  letter-spacing:1.5px;
}
.fd-profile-section-hint{
  margin:0 0 14px;
  font-size:0.78rem;
  line-height:1.45;
  color:rgba(255,255,255,0.55);
  letter-spacing:0.02em;
}
.fd-listening-history-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(132px,1fr));
  gap:14px;
  padding:4px 0 8px;
}
.fd-listening-history-card{
  cursor:pointer;
  border-radius:12px;
  overflow:hidden;
  border:1px solid rgba(241,196,15,0.22);
  background:rgba(0,0,0,0.35);
  transition:transform 0.2s ease,box-shadow 0.2s ease,border-color 0.2s ease;
}
.fd-listening-history-card:hover,.fd-listening-history-card:focus-visible{
  transform:translateY(-2px);
  border-color:rgba(241,196,15,0.5);
  box-shadow:0 10px 28px rgba(0,0,0,0.45);
  outline:none;
}
.fd-listening-history-cover-wrap{display:flex;flex-direction:column;align-items:stretch;}
.fd-listening-history-cover{
  display:block;
  width:100%;
  height:auto;
  aspect-ratio:250/375;
  object-fit:cover;
  vertical-align:top;
}
.fd-listening-history-title{
  padding:10px 8px 12px;
  font-size:0.82rem;
  font-weight:600;
  line-height:1.35;
  color:rgba(255,248,230,0.95);
  text-align:center;
}

/* Header — no outer frame; Prompt + bold desktop menus */
header{
  border:none !important;
  box-shadow:none !important;
  outline:none !important;
  background:transparent !important;
}
@media (min-width: 1200px){
  header .nav-group nav[aria-label="เมนูหลัก"] a,
  header .nav-group #navLoginBtn{
    font-family:'Prompt', sans-serif !important;
    font-weight:700 !important;
  }
  body.fd-user-logged-in header .nav-group nav[aria-label="เมนูหลัก"]::after{
    content:'|';
    display:inline-block;
    margin-left:18px;
    padding-right:10px;
    color:var(--fd-metallic-gold);
    font-family:'Prompt', sans-serif !important;
    font-weight:300;
    opacity:0.92;
    user-select:none;
    vertical-align:middle;
  }
}

/* Tablet + mobile (≤1023px): วงกลมจิ๋วมุมซ้ายล่าง — แตะขอบวงกลมขยายเต็ม; ปุ่มเล่นกลางซ้อนบนปก */
@media (max-width: 1023px){
  body{
    padding-bottom:76px !important;
    transition:padding-bottom .6s cubic-bezier(0.22, 1, 0.36, 1);
  }
  body.audio-player-expanded{
    padding-bottom:148px !important;
  }
  #audioPlayer.player-container:not(.player-expanded),
  #audioPlayer:not(.player-expanded){
    position:fixed !important;
    left:14px !important;
    right:auto !important;
    bottom:14px !important;
    transform:none !important;
    width:58px !important;
    min-width:58px !important;
    max-width:58px !important;
    height:58px !important;
    min-height:58px !important;
    max-height:58px !important;
    margin:0 !important;
    padding:0 !important;
    flex-direction:column !important;
    align-items:center !important;
    justify-content:center !important;
    gap:0 !important;
    border-radius:50% !important;
    overflow:visible !important;
    border:1px solid color-mix(in srgb, var(--fd-metallic-gold) 48%, transparent) !important;
    box-shadow:0 8px 28px rgba(0,0,0,0.5) !important;
    touch-action:manipulation;
    z-index:2000;
    background:rgba(8,8,12,0.75) !important;
    backdrop-filter:blur(12px) !important;
    -webkit-backdrop-filter:blur(12px) !important;
  }
  #audioPlayer:not(.player-expanded)::before{
    display:none !important;
  }
  #audioPlayer:not(.player-expanded) .player-collapse-btn{
    display:none !important;
  }
  #audioPlayer:not(.player-expanded) .player-mini-bar{
    position:relative !important;
    width:58px !important;
    height:58px !important;
    min-width:58px !important;
    min-height:58px !important;
    max-width:58px !important;
    max-height:58px !important;
    padding:0 !important;
    margin:0 !important;
    border-radius:50% !important;
    overflow:hidden !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    box-sizing:border-box !important;
  }
  #audioPlayer:not(.player-expanded) .player-mini-title-wrap{
    display:none !important;
    width:0 !important;
    height:0 !important;
    overflow:hidden !important;
  }
  #audioPlayer:not(.player-expanded) .player-mini-cover{
    position:absolute !important;
    inset:0 !important;
    width:100% !important;
    height:100% !important;
    border-radius:50% !important;
    object-fit:cover !important;
    border:none !important;
    box-shadow:none !important;
    margin:0 !important;
  }
  #audioPlayer:not(.player-expanded) .player-mini-pp-btn{
    position:absolute !important;
    left:50% !important;
    top:50% !important;
    transform:translate(-50%,-50%) !important;
    width:44px !important;
    height:44px !important;
    min-width:44px !important;
    min-height:44px !important;
    padding:0 !important;
    margin:0 !important;
    font-size:0.8rem !important;
    z-index:2 !important;
    border-radius:50% !important;
    background:rgba(0,0,0,0.5) !important;
    border:1px solid color-mix(in srgb, var(--fd-metallic-gold) 42%, transparent) !important;
    box-shadow:0 2px 12px rgba(0,0,0,0.45) !important;
    color:var(--text-gold) !important;
  }
  #audioPlayer:not(.player-expanded) .player-full-body{
    display:none !important;
  }
  /* ขยายเต็ม */
  #audioPlayer.player-expanded{
    position:fixed !important;
    left:14px !important;
    right:auto !important;
    bottom:14px !important;
    transform:none !important;
    width:auto !important;
    min-width:min(320px, calc(100vw - 28px)) !important;
    max-width:min(420px, calc(100vw - 24px)) !important;
    min-height:124px !important;
    height:auto !important;
    max-height:none !important;
    padding:10px 12px 12px !important;
    border-radius:22px !important;
    flex-direction:column !important;
    align-items:stretch !important;
    overflow:hidden !important;
    border:1px solid color-mix(in srgb, var(--fd-metallic-gold) 38%, transparent) !important;
    box-shadow:0 14px 40px rgba(0,0,0,0.55), 0 0 0 1px rgba(212,175,55,0.12) !important;
    background:rgba(10,10,10,0.9) !important;
  }
  #audioPlayer.player-expanded .player-mini-bar{
    display:none !important;
  }
  #audioPlayer.player-expanded .player-full-body{
    display:flex !important;
    flex-wrap:wrap !important;
    width:100% !important;
    max-width:100% !important;
    box-sizing:border-box !important;
    gap:10px !important;
    align-items:center !important;
    justify-content:center !important;
  }
  #audioPlayer.player-expanded .vinyl-wrapper{
    display:none !important;
  }
  #audioPlayer.player-expanded #playingTitle{
    min-width:100% !important;
    order:1 !important;
    text-align:center !important;
    font-size:12px !important;
    margin:4px 0 0 0 !important;
    font-family:'Prompt', sans-serif !important;
    font-weight:700 !important;
  }
  #audioPlayer.player-expanded .player-controls{
    order:2 !important;
    width:100% !important;
    justify-content:center !important;
    margin:0 !important;
  }
  #audioPlayer.player-expanded .player-progress-row{
    order:3 !important;
    width:100% !important;
    max-width:100% !important;
    box-sizing:border-box !important;
    flex-wrap:nowrap !important;
    gap:10px !important;
  }
  #audioPlayer.player-expanded #playBtn{
    width:48px !important;
    height:48px !important;
    min-width:48px !important;
    min-height:48px !important;
    font-size:1rem !important;
  }
  #audioPlayer.player-expanded .control-btn{
    width:38px !important;
    height:38px !important;
    font-size:1rem !important;
  }
  #audioPlayer.player-expanded .player-collapse-btn{
    display:none !important;
  }
  #audioPlayer.player-expanded.player-paused-ui .player-collapse-btn{
    display:flex !important;
  }
  #audioPlayer.player-expanded .player-collapse-btn{
    top:8px;
    right:10px;
  }
  #audioPlayer .player-mini-title-marquee{
    font-family:'Prompt', sans-serif !important;
  }
}

/* CLS Targeted Fix (CSS only, append-only) */
.all-stories-section #allNovelsGrid{
  min-height:800px !important;
}
body.splash-active header{
  height:70px !important;
}
body.fd-user-logged-in #navUserProfile .fd-nav-diamond-num{
  font-variant-numeric: tabular-nums;
}
body.fd-user-logged-in #navUserProfile{
  min-width:170px;
}

/* Mobile Optimization — Header Right align (append-only) */
@media (max-width: 768px) {
  /* ปรับให้ Container หลักของเมนูชิดขวา */
  .nav-group,
  #navUserProfile,
  .fd-nav-user-wrap {
    margin-left: auto !important;
    margin-right: 0 !important;
    display: flex;
    justify-content: flex-end;
    align-items: center;
  }

  /* ปรับความกว้างที่เคยจองไว้ให้พอดีกับหน้าจอมือถือ */
  body.fd-user-logged-in #navUserProfile {
    min-width: fit-content;
    padding-right: 5px;
  }

  /* ตรวจสอบกลุ่มปุ่มค้นหาให้ชิดขวาตามไปด้วย */
  .nav-group-search {
    margin-left: 10px;
  }
}

/* CLS Fix Phase 2 — reserve Hero + card space (append-only) */
.novel-big-cover{
  aspect-ratio:2/3 !important;
  object-fit:cover !important;
  display:block !important;
  max-width:100%;
  background-color:#1a1a1a;
}
.rank-card,.novel-grid-item{
  display:flex;
  flex-direction:column;
  min-height:280px;
}
@media (max-width: 768px){
  .rank-card,.novel-grid-item{
    min-height:340px;
  }
}

