/* ============================================================================
   theme.css — ระบบดีไซน์หลักของ ThaiFlixAI (แนว Dark Cinematic)
   ใช้ร่วมกันทุกหน้าของเว็บไซต์จริง (ไม่ใช่หน้าทดสอบ) — โหลดไฟล์นี้ก่อน CSS เฉพาะหน้าเสมอ
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600;700;800&family=Noto+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* พื้นหลัง — ดำอมน้ำเงินเข้ม ไม่ใช่ดำสนิท ให้ภาพปกซีรีส์เด่นและดูมีมิติ */
  --bg-base: #0a0a10;
  --bg-raised: #14141c;
  --bg-card: #1a1a24;
  --bg-card-hover: #23232f;
  --bg-overlay: rgba(10, 10, 16, 0.86);

  /* ตัวอักษร */
  --text-primary: #f5f5f7;
  --text-secondary: #a6a6b3;
  --text-muted: #6b6b78;

  /* สีหลักของแบรนด์ — ม่วงอมชมพู (สื่อถึง AI/อนาคต) เป็นจุดเด่น ต่างจาก Netflix แดง/Viu เขียว */
  --brand-500: #a855f7;
  --brand-400: #c084fc;
  --brand-600: #9333ea;
  --brand-glow: rgba(168, 85, 247, 0.35);

  /* สีทอง — ใช้กับพอยต์/เครดิต/ราคาเท่านั้น ไม่ปนกับสีแบรนด์ */
  --coin-500: #f5b301;
  --coin-400: #ffd23f;

  /* สถานะ */
  --danger-500: #ef4444;
  --success-500: #22c55e;

  /* เส้นขอบ */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  /* ระยะ/ขอบมน */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-elevated: 0 12px 40px rgba(0, 0, 0, 0.55);

  --font-body: 'Noto Sans Thai', 'Noto Sans', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

/* กัน element ที่มี attribute hidden โผล่มาโดยไม่ตั้งใจ เวลา CSS อื่นในหน้าไปตั้ง display
   ทับ (เช่น .some-class{display:flex}) — [hidden] ปกติเป็นกฎของเบราว์เซอร์เอง (UA stylesheet)
   ซึ่งแพ้ CSS ที่เราเขียนเองเสมอถ้า specificity เท่ากัน ใส่ !important ตรงนี้ให้ hidden ชนะทุกกรณี */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* กันหน้าเลื่อนซ้าย-ขวาได้บนจอมือถือ เผื่อมี element ไหนดันขอบจอ */
  max-width: 100vw;
}

body {
  min-height: 100vh;
}

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

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

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

/* ----------------------------------------------------------------------------
   Layout helpers
   ---------------------------------------------------------------------------- */
.container {
  /* เดิมจำกัดไว้ที่ 1400px ทำให้จอกว้างๆ เห็นขอบว่างซ้าย-ขวาเยอะ เทียบกับคู่แข่งที่เนื้อหาเต็มจอ
     (ต.ค. 2026) ขยายให้กว้างขึ้นมาก แต่ยังกันไว้ไม่ให้ยืดสุดโต่งบนจอ 4K/อัลตร้าไวด์ */
  max-width: 2200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}
@media (max-width: 640px) {
  .container { padding: 0 var(--space-4); }
}

/* ----------------------------------------------------------------------------
   Top navigation
   ---------------------------------------------------------------------------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-3) var(--space-6);
  background: linear-gradient(to bottom, rgba(10,10,16,0.95), rgba(10,10,16,0.75));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
}
.topnav .logo {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, var(--brand-400), var(--coin-400));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}
.topnav .fortune-link {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  flex: 0 0 auto;
}
.topnav .fortune-link:hover { color: var(--text-primary); }
.topnav .search-box {
  flex: 1;
  max-width: 420px;
  min-width: 0; /* กัน flex item ดันความกว้างเกิน container จนล้นขอบจอมือถือ */
}
.topnav .search-box input {
  width: 100%;
}

/* ----------------------------------------------------------------------------
   Top navigation — มือถือจอแคบ: ย่อโลโก้/ปุ่ม แล้วดันช่องค้นหาลงแถวล่างแทน
   กันไม่ให้โลโก้+ยอดพอยต์+ปุ่มล้นขอบจอจนต้องเลื่อนซ้าย-ขวา (ปัญหาที่เจอจริงบนมือถือ)
   ---------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .topnav {
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
  }
  .topnav .logo {
    font-size: 1.05rem;
  }
  .topnav .search-box {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
  }
  .topnav .nav-right {
    gap: var(--space-2);
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .topnav .nav-right .btn {
    padding: 0.45rem 0.7rem;
    font-size: 0.78rem;
  }
  .topnav .nav-right .coin-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.55rem;
  }
  .topnav .nav-right .shortcut-box {
    font-size: 0.72rem;
    padding: 0.25rem 0.5rem;
  }
}
.topnav .nav-genres {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav .nav-genres::-webkit-scrollbar { display: none; }
.topnav .nav-genres a {
  font-size: 0.9rem;
  color: var(--text-secondary);
  white-space: nowrap;
  padding: var(--space-1) 0;
  border-bottom: 2px solid transparent;
}
.topnav .nav-genres a:hover,
.topnav .nav-genres a.active {
  color: var(--text-primary);
  border-bottom-color: var(--brand-500);
}
.topnav .nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  white-space: nowrap;
}

/* ----------------------------------------------------------------------------
   Buttons
   ---------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: none;
  border-radius: var(--radius-md);
  padding: 0.6rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff;
  box-shadow: 0 4px 16px var(--brand-glow);
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-coin {
  background: linear-gradient(135deg, var(--coin-400), var(--coin-500));
  color: #1a1200;
}
.btn-coin:hover { filter: brightness(1.05); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}
.btn-ghost:hover { background: var(--bg-card-hover); }

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

/* ----------------------------------------------------------------------------
   Form controls
   ---------------------------------------------------------------------------- */
input, select, textarea {
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  outline: none;
  transition: border-color 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand-500);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }

/* ----------------------------------------------------------------------------
   Points / coin badge
   ---------------------------------------------------------------------------- */
.coin-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: rgba(245, 179, 1, 0.12);
  color: var(--coin-400);
  border: 1px solid rgba(245, 179, 1, 0.35);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
}
.coin-badge::before { content: '🪙'; font-size: 0.9em; }

/* ----------------------------------------------------------------------------
   ปุ่มทางลัด "รับพอยต์ฟรี" / "สร้างรายได้" ในแถบบนสุด — เดิมฟีเจอร์ 2 อันนี้อยู่ลึกในหน้า
   "บัญชีของฉัน" คนเห็นน้อย ย้ายมาเป็นปุ่มทางลัดข้างยอดพอยต์แทน ให้เห็นได้ทุกหน้า (ต.ค. 2026)
   ---------------------------------------------------------------------------- */
.shortcut-box {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  transition: filter 0.15s ease, transform 0.12s ease;
}
.shortcut-box:hover { filter: brightness(1.15); }
.shortcut-box:active { transform: scale(0.97); }
.shortcut-box--green {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.4);
}
.shortcut-box--gold {
  background: rgba(217, 180, 90, 0.16);
  color: #f9e8b6;
  border: 1px solid rgba(217, 180, 90, 0.5);
}
.topnav .contest-shortcut { flex: 0 0 auto; text-decoration: none; }
@media (max-width: 640px) { .topnav .contest-shortcut { font-size: .74rem; padding: .25rem .55rem; } }
.shortcut-box--teal {
  background: rgba(13, 148, 136, 0.18);
  color: #2dd4bf;
  border: 1px solid rgba(13, 148, 136, 0.45);
}

/* ----------------------------------------------------------------------------
   Series card
   ---------------------------------------------------------------------------- */
.series-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  flex: 0 0 auto;
}
.series-card:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: var(--shadow-elevated);
  z-index: 2;
}
.series-card .poster {
  aspect-ratio: 2 / 3;
  width: 100%;
  background: linear-gradient(160deg, #23232f, #14141c);
  background-size: cover;
  background-position: center;
}
.series-card .poster-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: center;
  padding: var(--space-2);
}

/* กรอบตัวอย่างภาพปกในหน้าอัพโหลด (uploader.html) — ต้องเป็นสัดส่วนเดียวกับ
   .series-card .poster ด้านบน (2:3) เป๊ะๆ เพราะเป็นกรอบที่ใช้แสดงภาพปกจริงให้สมาชิกเห็น
   ทั่วเว็บ (หน้าแรก/หน้าค้นหา) — ถ้าแก้สัดส่วนโปสเตอร์ด้านบน ต้องแก้ตัวนี้ให้ตรงกันด้วย */
.cover-preview-frame {
  width: 160px;
  max-width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: var(--space-2);
  background: linear-gradient(160deg, #23232f, #14141c);
}
.cover-preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* กรอบตัวอย่าง "แนะนำสำหรับคุณ" หน้าแรก (16:9) — ใช้คู่กับ slider ปรับจุดโฟกัสแนวตั้ง
   (cover_focal_y) ในหน้าอัพโหลด ให้คนอัพเห็นภาพจริงที่จะโผล่บนหน้าแรกก่อนบันทึก แทนที่จะเดา
   เหมือนเดิม ซึ่งทำให้บางโปสเตอร์หัวตัวละครโดนตัดโดยไม่มีใครรู้จนมีคนดูมาทักท้วง */
.cover-hero-preview-frame {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: var(--space-2);
  background: linear-gradient(160deg, #23232f, #14141c);
}
.cover-hero-preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.focal-slider-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  max-width: 320px;
}
.focal-slider-row input[type="range"] { flex: 1; }
.focal-slider-row .focal-value { font-size: 0.8rem; color: var(--text-muted); min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.series-card .meta {
  padding: var(--space-2) var(--space-3) var(--space-3);
}
.series-card .meta .title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rating-stars { display: flex; gap: 2px; }
.rating-star {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--border-strong);
  cursor: pointer;
  padding: 0;
  transition: color 0.1s ease, transform 0.1s ease;
}
.rating-star:hover { transform: scale(1.12); }
.rating-star.is-filled { color: #f5b400; }
.series-card .meta .card-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.series-card .poster { position: relative; }
.series-card .badge-new {
  position: absolute; top: 6px; right: 6px;
  font-size: 0.68rem; font-weight: 800; line-height: 1;
  color: #fff; background: linear-gradient(135deg, #ef4444, #c026d3);
  padding: 4px 7px; border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0,0,0,.45);
}
.series-card .meta .card-rate {
  display: flex; gap: 8px; align-items: center;
  font-size: 0.72rem; margin-top: 2px; color: var(--text-secondary);
}
.series-card .meta .card-star { color: #f5b400; font-weight: 700; }
.series-card .badge-rank {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 2.4rem;
  font-weight: 800;
  font-style: italic;
  color: transparent;
  -webkit-text-stroke: 2px var(--brand-400);
  padding: 0 0.3rem;
  line-height: 1;
  opacity: 0.9;
}

/* ----------------------------------------------------------------------------
   Rails (แถวเลื่อนซีรีส์)
   ---------------------------------------------------------------------------- */
.rail {
  margin: var(--space-8) 0;
}
.rail-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.rail-header h2 {
  font-size: 1.15rem;
  margin: 0;
}
.rail-track {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  scroll-behavior: smooth;
}
.rail-track::-webkit-scrollbar { height: 6px; }
.rail-track::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.rail-track .series-card { width: 160px; }
.rail-track.rail-rank .series-card { width: 200px; }

/* บนจอมือถือแคบ บังคับขนาดการ์ดเป็นสัดส่วนของความกว้างจอแทนขนาดคงที่ กันการ์ดดูใหญ่
   เกินไปจนเห็นแค่เรื่องเดียวต่อแถว (ปัญหาที่เจอจริงบนมือถือจอเล็ก) — ปรับให้เห็นพร้อมกัน
   ประมาณ 2.3-2.5 เรื่องต่อแถวเสมอ ไม่ว่าจอจะกว้างแค่ไหน แล้วเลื่อนซ้าย-ขวาดูเรื่องถัดไป */
@media (max-width: 480px) {
  .rail-track .series-card { width: 38vw; max-width: 165px; }
  .rail-track.rail-rank .series-card { width: 42vw; max-width: 190px; }
}

/* ----------------------------------------------------------------------------
   Hero / highlight carousel
   ---------------------------------------------------------------------------- */
.hero-carousel {
  position: relative;
  display: flex;
  gap: var(--space-4);
  overflow: hidden;
  border-radius: var(--radius-lg);
}
.hero-slide {
  position: relative;
  flex: 0 0 calc((100% - 2 * var(--space-4)) / 3);
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(160deg, #23232f, #14141c);
  background-size: cover;
  /* แก้ ต.ค. 2026 (รอบ 2): รูปปกเป็นโปสเตอร์แนวตั้ง ยัดใส่กรอบแนวนอน 16:9 นี้ — ลองยึด "ขอบบนสุด"
     (0%) ไปรอบแรกแล้วหัวบางรูปมาติดขอบเป๊ะจนดูเหมือนโดนตัดอยู่ดี เปลี่ยนมาใช้ 18% จากขอบบนแทน
     (ไม่ใช่กึ่งกลาง 50% แบบเดิม และไม่ใช่ขอบบนสุด 0%) เผื่อระยะหายใจไว้นิดหน่อย ช่วยได้กับโปสเตอร์
     ส่วนใหญ่ที่หัวอยู่ค่อนไปทางบน — ข้อจำกัดคือ CSS จุดเดียวนี้ปรับให้ "ทุกรูปพร้อมกัน" ไม่รู้ว่าหัว
     ของแต่ละโปสเตอร์อยู่ตรงไหนจริงๆ ถ้าโปสเตอร์เรื่องไหนจัดองค์ประกอบต่างจากเรื่องอื่นมาก (เช่น
     ตัวละครอยู่ค่อนไปทางล่าง/กลางภาพ) จุดนี้เพียงอย่างเดียวแก้ให้ไม่ได้ครบ 100% ทุกเรื่อง ถ้าอยาก
     ให้เป๊ะทุกเรื่องต้องเพิ่มช่อง "จุดโฟกัสรูปปก" ให้แอดมินตั้งเองทีละเรื่องแทน (บอกได้ถ้าอยากทำ) */
  background-position: center 18%;
}
.hero-slide .hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg-overlay) 0%, transparent 60%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-4);
}
.hero-slide .hero-title {
  font-size: 1.1rem;
  font-weight: 700;
}
@media (max-width: 900px) {
  .hero-slide { flex: 0 0 calc((100% - var(--space-4)) / 2); }
}
@media (max-width: 560px) {
  .hero-slide { flex: 0 0 100%; }
}

/* ----------------------------------------------------------------------------
   Card / panel generic
   ---------------------------------------------------------------------------- */
.panel {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

/* ----------------------------------------------------------------------------
   Ad slot placeholder
   ---------------------------------------------------------------------------- */
.ad-slot {
  background: repeating-linear-gradient(45deg, var(--bg-raised), var(--bg-raised) 10px, var(--bg-card) 10px, var(--bg-card) 20px);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  min-height: 250px;
  overflow: hidden;
}

/* โฆษณาแบบมีรูปจริงแล้ว (แปะโชว์เฉยๆ ยังกดไปไหนไม่ได้) — ตัดพื้นหลัง/เส้นประของ placeholder ออก
   ให้รูปเต็มกรอบพอดีขนาด
   แก้ ต.ค. 2026: เดิมตั้งแค่ min-height ทำให้พอรูปจริงสัดส่วนไม่พอดีเป๊ะ height:100% ของ <img>
   คำนวณไม่ได้ (parent ไม่มีความสูงตายตัว) ภาพเลยลอยกลางกล่องเหลือพื้นที่ว่างโบ๋ด้านบน/ล่าง —
   เปลี่ยนมาใช้ aspect-ratio ตามขนาดมาตรฐานโฆษณาจริงแทน (300×600 / 300×250) ความสูงเลยคำนวณ
   ได้ชัดเจนเสมอ ไม่ว่าคอลัมน์จะกว้างแคบแค่ไหน
   แก้ ต.ค. 2026 (รอบ 2): เปลี่ยนจาก object-fit: cover เป็น contain — รอบแรกตั้งใจ crop ส่วนเกิน
   กันภาพยืด/บีบผิดสัดส่วน แต่พอเจ้าของโฆษณาส่งรูปมาสัดส่วนไม่ตรงกับกรอบมาตรฐาน (300×600 ผอมสูง
   / 300×250 กว้างเตี้ย) พอดีเป๊ะ cover เลย crop เนื้อหาโฆษณา (ข้อความ/โลโก้) หายไปเยอะ จนเจ้าของ
   โฆษณาทักว่าภาพไม่เต็ม — contain โชว์ภาพเต็มครบทุกส่วนเสมอ แลกกับอาจมีแถบว่างด้านข้าง/บนล่าง
   บ้างถ้าสัดส่วนไม่พอดีเป๊ะ (เติมพื้นหลังกลืนธีมเว็บไว้กันแถบว่างดูเป็น bug) */
.ad-slot.has-image {
  background: var(--bg-card);
  border: none;
  padding: 0;
  min-height: 0;
}
.ad-slot--skyscraper { aspect-ratio: 300 / 600; }
.ad-slot--mrec { aspect-ratio: 300 / 250; }
.ad-slot.has-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: var(--radius-md);
}

/* ----------------------------------------------------------------------------
   Footer
   ---------------------------------------------------------------------------- */
.site-footer {
  margin-top: var(--space-12);
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-8) 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.site-footer a { color: var(--text-secondary); }
.site-footer a:hover { color: var(--text-primary); }
.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}

/* ----------------------------------------------------------------------------
   บล็อก "ติดตามเราทาง LINE" ท้ายเว็บทุกหน้า — ปิดลูป เว็บ -> LINE OA -> Rich Menu -> กลับเว็บ
   ---------------------------------------------------------------------------- */
.footer-line {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 360px;
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color 0.15s;
}
.footer-line:hover { border-color: var(--brand-500); }
.footer-line img {
  width: 56px;
  height: 56px;
  background: #fff;
  padding: 5px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.footer-line .ft-text { display: flex; flex-direction: column; gap: 2px; }
.footer-line .ft-title { font-size: 0.85rem; font-weight: 700; color: var(--text-primary) !important; }
.footer-line .ft-sub { font-size: 0.76rem; color: var(--text-muted); line-height: 1.4; }

/* ----------------------------------------------------------------------------
   ข้อความคั่น/สถานะว่าง (ใช้ร่วมกันหลายหน้า)
   ---------------------------------------------------------------------------- */
.hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: var(--space-4) 0;
}

/* ----------------------------------------------------------------------------
   ตารางการ์ดซีรีส์ (หน้าค้นหา/หมวดหมู่)
   ---------------------------------------------------------------------------- */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-4);
}
/* จอมือถือแคบ: ลดขนาดขั้นต่ำของการ์ดลง กัน grid เหลือแค่ 1 คอลัมน์แล้วการ์ดถูกยืด (1fr)
   จนดูใหญ่เต็มจอทั้งที่ตั้งใจให้เป็นตาราง 2-3 คอลัมน์ */
@media (max-width: 480px) {
  .grid-cards { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: var(--space-3); }
}

/* ----------------------------------------------------------------------------
   หน้ารายละเอียดซีรีส์ — แบนเนอร์ + แท็กหมวดหมู่
   ---------------------------------------------------------------------------- */
.series-hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 320px;
  background: linear-gradient(160deg, #23232f, #14141c);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
  margin-top: var(--space-4);
}
.series-hero .series-hero-overlay {
  width: 100%;
  background: linear-gradient(to top, var(--bg-overlay) 10%, transparent 75%);
  padding: var(--space-6);
}
.series-hero .series-hero-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 var(--space-2);
}
.series-hero .series-hero-synopsis {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 640px;
  margin: 0 0 var(--space-3);
}
.genre-tag {
  display: inline-block;
  background: rgba(168, 85, 247, 0.14);
  color: var(--brand-400);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.75rem;
  margin: 0 var(--space-2) var(--space-2) 0;
}

/* ----------------------------------------------------------------------------
   รายการตอน (หน้ารายละเอียดซีรีส์ + หน้าเล่นวิดีโอ)
   ---------------------------------------------------------------------------- */
.ep-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  margin-bottom: var(--space-2);
}
.ep-row .ep-name {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ep-row.ep-row-active {
  background: rgba(168, 85, 247, 0.14);
  border: 1px solid rgba(168, 85, 247, 0.35);
}
.ep-tag {
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  white-space: nowrap;
}
.ep-tag-free { background: rgba(34, 197, 94, 0.14); color: var(--success-500); }
.ep-tag-unlocked { background: rgba(168, 85, 247, 0.14); color: var(--brand-400); }
.ep-tag-locked { background: rgba(245, 179, 1, 0.12); color: var(--coin-400); }

/* ----------------------------------------------------------------------------
   กรอบวิดีโอ (หน้าเล่น — ค่าเริ่มต้น 16:9, watch.html จะปรับ padding-top
   ด้วย JS ตามสัดส่วนจริงที่ผู้อัพโหลดเลือกไว้ต่อตอน)
   ---------------------------------------------------------------------------- */
.video-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.video-wrapper iframe,
.video-wrapper video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}
.video-wrapper .video-state {
  position: absolute;
  inset: 0;
  z-index: 1; /* ต้องอยู่ทับ <video>/<iframe> เสมอตอนกำลังโหลด (ต.ค. 2026) ไม่งั้นโดนปกไปเพราะต่อท้ายใน DOM ทีหลัง */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-3);
  color: var(--text-secondary);
  text-align: center;
  padding: var(--space-4);
  background: rgba(10, 10, 16, 0.55); /* ให้อ่านง่ายแม้ทับบน poster image ที่สว่าง */
}

/* ============================================================================
   [ต.ค. 2026] หมวดหมู่แบบพรีเมียม (ทอง-งาช้าง บนพื้นดำ) — อ่านง่ายสำหรับคนสายตาไม่ดี
   เดิมตัวหนังสือหมวดหมู่เป็นสีเทา (#a6a6b3) และบนมือถือเล็กแค่ ~9.6px ในคอลัมน์แคบ 56px
   ตอนนี้: ตัวหนังสือสีงาช้างสว่าง (คอนทราสต์ ~15:1 กับพื้น) + หมวดที่เลือกเป็นปุ่มทองไล่เฉด
   บนมือถือเปลี่ยนเมนูซ้ายเป็นแถบปุ่มเลื่อนแนวนอนเต็มความกว้าง ตัวหนังสือใหญ่ 15px
   (ใช้ selector .layout .sidebar ให้ชนะ CSS เดิมที่ฝังในหน้า index.html/browse.html)
   ============================================================================ */
:root {
  --lux-ivory: #f4ecdc;          /* งาช้าง — ตัวหนังสือหลักของหมวดหมู่ */
  --lux-gold-1: #f9e8b6;         /* ทองแชมเปญอ่อน */
  --lux-gold-2: #d9b45a;         /* ทองหลัก */
  --lux-gold-3: #a97f2a;         /* ทองเข้ม (เงา) */
  --lux-gold-line: rgba(217, 180, 90, 0.38);
  --lux-gold-soft: rgba(217, 180, 90, 0.12);
  --lux-gold-grad: linear-gradient(135deg, var(--lux-gold-1) 0%, var(--lux-gold-2) 48%, var(--lux-gold-3) 100%);
}

.layout .sidebar .heading {
  color: var(--lux-gold-2);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0 var(--space-3);
  margin-bottom: var(--space-3);
}
.layout .sidebar a {
  color: var(--lux-ivory);
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.layout .sidebar a:hover {
  background: var(--lux-gold-soft);
  color: var(--lux-gold-1);
  border-color: var(--lux-gold-line);
}
.layout .sidebar a.active {
  background: var(--lux-gold-grad);
  color: #1c1406;
  font-weight: 700;
  border-color: transparent;
  box-shadow: 0 4px 18px rgba(217, 180, 90, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.layout .sidebar .sidebar-more-toggle {
  color: var(--lux-gold-2);
  font-size: 0.85rem;
  font-weight: 600;
}
.layout .sidebar .sidebar-more-toggle:hover {
  background: var(--lux-gold-soft);
  color: var(--lux-gold-1);
}

/* มือถือ: เมนูซ้ายแคบๆ -> แถบปุ่มหมวดหมู่เลื่อนแนวนอนเหนือเนื้อหา (แบบแอปดูหนังระดับโลก) */
@media (max-width: 700px) {
  .layout { grid-template-columns: minmax(0, 1fr) !important; }
  .layout .sidebar {
    position: static;
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    padding: var(--space-3) 0 var(--space-1);
    margin: 0 calc(-1 * var(--space-4));
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scroll-padding-inline: var(--space-4);
    mask-image: linear-gradient(to right, #000 88%, transparent);
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent);
  }
  .layout .sidebar::-webkit-scrollbar { display: none; }
  .layout .sidebar .heading,
  .layout .sidebar .sidebar-more-toggle { display: none !important; }
  .layout .sidebar #sidebar-more-wrap { display: contents !important; }
  .layout .sidebar a {
    flex: 0 0 auto;
    scroll-snap-align: start;
    font-size: 0.94rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 9px 16px;
    margin: 0;
    text-align: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--lux-gold-line);
    white-space: nowrap;
  }
  .layout .sidebar a.active { border-color: transparent; }
  .layout .maincol { padding-top: var(--space-3); }
}

/* แท็กหมวดหมู่ในหน้ารายละเอียดเรื่อง — จากม่วงจางบนม่วง เป็นงาช้างขอบทอง อ่านชัดขึ้นมาก */
.genre-tag {
  background: var(--lux-gold-soft);
  color: var(--lux-ivory);
  border: 1px solid var(--lux-gold-line);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.28rem 0.8rem;
}
/* เมนูหมวดหมู่บนแถบด้านบน (บางหน้า) */
.topnav .nav-genres a { color: var(--lux-ivory); font-weight: 500; }
.topnav .nav-genres a:hover,
.topnav .nav-genres a.active { color: var(--lux-gold-1); border-bottom-color: var(--lux-gold-2); }

/* ============================================================================
   [ต.ค. 2026] กล่องข้อความลอยแบบพรีเมียม (lux sheet) — ต้อนรับ/สมัคร, ติดตั้งแอป, เปิดใน Chrome
   มือถือ: เลื่อนขึ้นจากด้านล่าง (bottom sheet) / จอใหญ่: การ์ดกลางจอ
   ============================================================================ */
html.lux-lock, html.lux-lock body { overflow: hidden; }
.lux-backdrop {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(4, 4, 8, 0);
  -webkit-backdrop-filter: blur(0px); backdrop-filter: blur(0px);
  transition: background 0.25s ease, backdrop-filter 0.25s ease;
}
.lux-backdrop.is-open {
  background: rgba(4, 4, 8, 0.72);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.lux-sheet {
  position: relative;
  width: 100%; max-width: 440px;
  max-height: 92vh; overflow-y: auto;
  padding: 34px 24px calc(22px + env(safe-area-inset-bottom));
  text-align: center;
  color: var(--text-primary);
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(217, 180, 90, 0.16), transparent 60%),
    linear-gradient(180deg, #17151b 0%, #0e0d12 100%);
  border: 1px solid var(--lux-gold-line, rgba(217,180,90,0.38));
  border-bottom: none;
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.25, 1);
}
.lux-sheet::before { /* แถบจับด้านบนแบบ bottom sheet */
  content: ""; position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 42px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.18);
}
.lux-backdrop.is-open .lux-sheet { transform: translateY(0); }
@media (min-width: 701px) {
  .lux-backdrop { align-items: center; }
  .lux-sheet { border-radius: 26px; border-bottom: 1px solid var(--lux-gold-line, rgba(217,180,90,0.38)); transform: translateY(24px) scale(0.97); opacity: 0; transition: transform 0.3s ease, opacity 0.3s ease; padding-bottom: 26px; }
  .lux-sheet::before { display: none; }
  .lux-backdrop.is-open .lux-sheet { transform: none; opacity: 1; }
}
.lux-x {
  position: absolute; top: 14px; right: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.05);
  color: #cfc8b8; font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.lux-x:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.lux-appicon {
  width: 76px; height: 76px; border-radius: 20px; display: block;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(217, 180, 90, 0.45), 0 0 34px rgba(217, 180, 90, 0.22);
}
.lux-appicon--lg { width: 88px; height: 88px; border-radius: 22px; flex: 0 0 auto; }
.lux-hero-icon { position: relative; display: inline-block; margin: 6px auto 16px; }
.lux-hero-badge {
  position: absolute; right: -8px; bottom: -6px; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.95rem;
  color: #1c1406; background: var(--lux-gold-grad, linear-gradient(135deg,#f9e8b6,#d9b45a,#a97f2a));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
.lux-eyebrow { font-size: 0.82rem; color: var(--lux-gold-2, #d9b45a); font-weight: 600; letter-spacing: 0.04em; margin-bottom: 2px; }
.lux-title { font-size: 1.28rem; font-weight: 800; line-height: 1.35; margin: 0 0 8px; color: #fff; }
.lux-title--brand {
  font-size: 2rem; letter-spacing: 0.01em;
  background: var(--lux-gold-grad, linear-gradient(135deg,#f9e8b6,#d9b45a,#a97f2a));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lux-sub { font-size: 0.93rem; line-height: 1.65; color: #d8d1c2; margin: 0 auto 18px; max-width: 360px; }

.lux-perks { list-style: none; padding: 0; margin: 0 0 20px; text-align: left; display: grid; gap: 10px; }
.lux-perks li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(217, 180, 90, 0.18);
  font-size: 0.95rem; color: var(--lux-ivory, #f4ecdc); font-weight: 500;
}
.lux-perk-ico { font-size: 1.25rem; width: 28px; text-align: center; flex: 0 0 auto; }

.lux-btn-gold, .lux-btn-outline {
  display: flex; align-items: center; justify-content: center; width: 100%;
  min-height: 52px; border-radius: 14px; font-family: inherit; font-size: 1.02rem; font-weight: 800;
  text-decoration: none; cursor: pointer; margin-top: 10px; padding: 0 16px;
  transition: transform 0.12s ease, filter 0.15s ease;
}
.lux-btn-gold {
  border: none; color: #1c1406;
  background: var(--lux-gold-grad, linear-gradient(135deg,#f9e8b6,#d9b45a,#a97f2a));
  box-shadow: 0 10px 28px rgba(217, 180, 90, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.lux-btn-gold:hover { filter: brightness(1.05); }
.lux-btn-gold:active, .lux-btn-outline:active { transform: scale(0.98); }
.lux-btn-gold:disabled { filter: grayscale(0.4) brightness(0.85); cursor: default; font-size: 0.92rem; }
.lux-btn-outline {
  background: rgba(255, 255, 255, 0.03); color: var(--lux-ivory, #f4ecdc);
  border: 1px solid var(--lux-gold-line, rgba(217,180,90,0.38)); font-weight: 600; font-size: 0.95rem;
}
.lux-btn-outline:hover { background: rgba(217, 180, 90, 0.08); }
.lux-link {
  display: block; margin: 14px auto 0; background: none; border: none; cursor: pointer;
  color: #a9a294; font-family: inherit; font-size: 0.9rem; text-decoration: underline; text-underline-offset: 3px;
}
.lux-link:hover { color: #e6dfcf; }

.lux-steps { list-style: none; padding: 0; margin: 4px 0 6px; text-align: left; display: grid; gap: 10px; }
.lux-steps li {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.93rem; line-height: 1.5; color: #ece5d6;
}
.lux-steps b { color: #fff; }
.lux-step-no {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.85rem;
  color: #1c1406; background: var(--lux-gold-grad, linear-gradient(135deg,#f9e8b6,#d9b45a,#a97f2a));
}
.lux-ico { width: 20px; height: 20px; vertical-align: -4px; color: #6db3ff; display: inline-block; }
.lux-key {
  display: inline-block; padding: 0 7px; border-radius: 6px; font-weight: 800; letter-spacing: 1px;
  background: rgba(255, 255, 255, 0.12); color: #fff; line-height: 1.5;
}

/* หัวแบบหน้าร้านแอป */
.lux-store { display: flex; align-items: center; gap: 16px; text-align: left; margin: 6px 0 18px; }
.lux-store-meta { min-width: 0; }
.lux-store-name { font-size: 1.35rem; font-weight: 800; color: #fff; line-height: 1.2; }
.lux-store-tag { font-size: 0.86rem; color: var(--lux-gold-2, #d9b45a); margin: 3px 0 8px; font-weight: 600; }
.lux-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lux-chips span {
  font-size: 0.74rem; font-weight: 700; color: var(--lux-ivory, #f4ecdc);
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--lux-gold-line, rgba(217,180,90,0.38));
  background: rgba(217, 180, 90, 0.08);
}
.lux-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 0 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08); border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.lux-stats > div { padding: 12px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.lux-stats > div + div { border-left: 1px solid rgba(255, 255, 255, 0.08); }
.lux-stats b { font-size: 1.2rem; color: var(--lux-gold-1, #f9e8b6); }
.lux-stats span { font-size: 0.74rem; color: #cfc8b8; line-height: 1.35; }
.lux-link--small { font-size: 0.8rem; color: #8a8478; margin-top: 10px; }

/* ============================================================================
   [ต.ค. 2026 รอบ 3] "แนะนำสำหรับคุณ" แบบโปสเตอร์เต็มใบ — แก้หัวตัวละครโดนตัดบนจอคอม
   พื้นหลัง = โปสเตอร์เดียวกันเบลอ / โปสเตอร์จริงเต็มใบด้านขวา / ชื่อเรื่องด้านซ้าย
   ============================================================================ */
.hero-slide--poster { background: #0d0c12; isolation: isolate; }
.hero-slide--poster .hero-bg {
  position: absolute; inset: -24px; z-index: -1;
  background-size: cover; background-position: center;
  filter: blur(18px) brightness(0.85) saturate(1.35);
  transform: scale(1.08);
}
.hero-slide--poster .hero-poster {
  position: absolute; top: 10px; bottom: 10px; right: 10px;
  height: calc(100% - 20px); width: auto; max-width: 52%;
  object-fit: cover; object-position: center top;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(217, 180, 90, 0.35);
}
.hero-slide--poster .hero-overlay {
  background: linear-gradient(to right, rgba(8, 8, 12, 0.6) 0%, rgba(8, 8, 12, 0.15) 50%, transparent 70%), linear-gradient(to top, rgba(8, 8, 12, 0.45), transparent 55%);
  padding-right: 50%;
}
.hero-slide--poster .hero-title {
  font-size: 1.15rem; line-height: 1.35; text-wrap: balance;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
/* รูปปกแนวนอน: เต็มกรอบแบบเดิม */
.hero-slide--poster.is-landscape .hero-bg { inset: 0; filter: none; transform: none; }
.hero-slide--poster.is-landscape .hero-poster { display: none; }
.hero-slide--poster.is-landscape .hero-overlay {
  background: linear-gradient(to top, var(--bg-overlay) 0%, transparent 60%);
  padding-right: var(--space-4);
}

/* หน้ารายละเอียดเรื่อง: แบนเนอร์โปสเตอร์เต็มใบ (ซ้าย) + ข้อมูลเรื่อง (ขวา) บนพื้นหลังโปสเตอร์เบลอ */
.series-hero.series-hero--poster {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: end; gap: var(--space-6);
  padding: var(--space-6); min-height: 0; background: #0d0c12; isolation: isolate;
}
.series-hero--poster .sh-bg {
  position: absolute; inset: -30px; z-index: -2;
  background-size: cover; background-position: center;
  filter: blur(26px) brightness(0.8) saturate(1.35); transform: scale(1.1);
}
.series-hero--poster::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to right, rgba(8, 8, 12, 0.55), rgba(8, 8, 12, 0.15) 75%),
              linear-gradient(to top, rgba(8, 8, 12, 0.6), transparent 60%);
}
.series-hero--poster .sh-poster {
  display: block; width: clamp(150px, 20vw, 230px); height: auto; max-height: 340px; object-fit: cover; object-position: top;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(217, 180, 90, 0.4);
}
.series-hero--poster .series-hero-overlay { background: none; padding: 0; min-width: 0; }
.series-hero--poster .series-hero-title { font-size: clamp(1.5rem, 3vw, 2.2rem); text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); }
.series-hero--poster .series-hero-synopsis { color: #e6dfd0; font-size: 0.95rem; line-height: 1.7; }
@media (max-width: 600px) {
  .series-hero.series-hero--poster { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding: var(--space-6) var(--space-4); gap: var(--space-4); }
  .series-hero--poster .sh-poster { width: min(58vw, 230px); }
  .series-hero--poster .series-hero-overlay > div:last-child { justify-content: center; }
  .series-hero--poster .series-hero-synopsis { margin-left: auto; margin-right: auto; }
}

/* [ต.ค. 2026] กล่องต้อนรับ: ภาพพรีเซนเตอร์ (บอล) ด้านบน แสงทองด้านหลัง ไล่จางลงเนื้อกล่อง */
.lux-sheet::before { z-index: 3; }
.lux-x { z-index: 3; }
.lux-person {
  position: relative; height: 220px; margin: -34px -24px 6px;
  border-radius: 26px 26px 0 0; overflow: hidden;
  background:
    radial-gradient(55% 75% at 50% 78%, rgba(232, 192, 98, 0.55), rgba(232, 192, 98, 0.12) 60%, transparent 78%),
    linear-gradient(180deg, #221c12 0%, #17151b 100%);
}
.lux-person::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 70px;
  background: linear-gradient(to top, #17151b 8%, rgba(23, 21, 27, 0));
}
.lux-person-img {
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%);
  height: 240px; width: auto; max-width: none;
  filter: drop-shadow(0 0 18px rgba(240, 205, 120, 0.35));
}
.lux-person-badge {
  position: absolute; left: 20px; bottom: 14px; z-index: 2;
  width: 46px; height: 46px; border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(217, 180, 90, 0.55);
}
@media (min-width: 701px) { .lux-person { margin-top: -34px; } }

/* ----------------------------------------------------------------------------
   [ต.ค. 2026] ปุ่ม "หน้าแรก" + เมนูดรอปดาวน์ "บัญชีของฉัน"
   ---------------------------------------------------------------------------- */
.topnav .home-shortcut { flex: 0 0 auto; }
.acct-menu { position: relative; display: inline-flex; }
.acct-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  min-width: 220px; display: flex; flex-direction: column; padding: 6px;
  background: var(--bg-raised); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: var(--shadow-elevated); white-space: normal;
}
.acct-dropdown[hidden] { display: none; }
.acct-dropdown .acct-who {
  font-size: 0.75rem; color: var(--text-muted); padding: 6px 10px 8px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acct-dropdown a, .acct-dropdown button {
  display: block; width: 100%; text-align: left; font: inherit; font-size: 0.88rem;
  color: var(--text-primary); background: none; border: 0; border-radius: 8px;
  padding: 10px 10px; cursor: pointer; text-decoration: none;
}
.acct-dropdown a:hover, .acct-dropdown button:hover, .acct-dropdown a:focus-visible, .acct-dropdown button:focus-visible {
  background: var(--bg-card-hover); outline: none;
}
.acct-dropdown .acct-logout { color: #ff8a8a; border-top: 1px solid var(--border-subtle); border-radius: 0 0 8px 8px; margin-top: 4px; }
.acct-dropdown .acct-logout:disabled { opacity: .6; cursor: default; }
@media (max-width: 640px) {
  .topnav .home-shortcut { font-size: 0.72rem; padding: 0.25rem 0.5rem; }
}

/* [ต.ค. 2026] น้องพรุนในกล่องต้อนรับ / ติดตั้งแอป */
.lux-prun { display: flex; align-items: flex-end; gap: 8px; text-align: left; margin: 4px 0 14px; }
.lux-prun-img { width: 46px; height: 54px; flex: none; filter: drop-shadow(0 4px 10px rgba(168,85,247,.4)); }
.lux-prun-bubble { position: relative; flex: 1; min-width: 0; background: linear-gradient(180deg,#241b36,#1a1526);
  border: 1px solid rgba(192,132,252,.4); border-radius: 14px 14px 14px 4px; padding: 8px 11px; font-size: .84rem; line-height: 1.5; color: #ece9f5; }
.lux-prun-name { display: block; font-size: .68rem; font-weight: 700; color: #c084fc; margin-bottom: 1px; }

/* [ต.ค. 2026] น้องพรุนพาติดตั้ง — ลูกศรชี้ปุ่มเบราว์เซอร์ + การ์ดขั้นตอน */
.tfx-coach { position: fixed; inset: 0; z-index: 2000; background: rgba(6,4,12,.62); opacity: 0; transition: opacity .22s ease; }
.tfx-coach.is-open { opacity: 1; }
.tfx-coach-arrow { position: fixed; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 3.2rem; line-height: 1; color: #f5c542;
  text-shadow: 0 0 18px rgba(245,197,66,.85), 0 2px 0 #7a5a00; animation: tfxCoachBounceUp .9s ease-in-out infinite; }
.tfx-coach-arrow.at-top-right { top: 6px; right: 10px; }
.tfx-coach-arrow.at-bottom-right { bottom: calc(6px + env(safe-area-inset-bottom, 0px)); right: 14px; animation-name: tfxCoachBounceDown; }
.tfx-coach-arrow.at-bottom-center { bottom: calc(6px + env(safe-area-inset-bottom, 0px)); left: 0; right: 0; animation-name: tfxCoachBounceDown; }
.tfx-coach-arrow.at-top-right, .tfx-coach-arrow.at-bottom-right { align-items: flex-end; }
.tfx-coach-tag { font-size: .85rem; font-weight: 800; color: #1a1205; background: #f5c542; padding: 3px 10px; border-radius: 999px; text-shadow: none; white-space: nowrap; }
body:has(.tfx-coach) .tfxm { display: none !important; }
@keyframes tfxCoachBounceUp { 0%,100% { transform: translateY(8px); } 50% { transform: translateY(-4px); } }
@keyframes tfxCoachBounceDown { 0%,100% { transform: translateY(-8px); } 50% { transform: translateY(4px); } }
.tfx-coach-card { position: fixed; left: 14px; right: 14px; max-width: 420px; margin: 0 auto;
  background: linear-gradient(180deg,#241b36,#17131f); border: 1px solid rgba(192,132,252,.45); border-radius: 18px;
  padding: 16px 16px 14px; color: #f3eefc; box-shadow: 0 18px 50px rgba(0,0,0,.6); }
.tfx-coach-card.card-bottom { bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
.tfx-coach-card.card-top { top: 70px; }
.tfx-coach-x { position: absolute; top: 8px; right: 10px; background: none; border: 0; color: #b9a8d6; font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 4px 8px; }
.tfx-coach-head { display: flex; align-items: center; gap: 10px; }
.tfx-coach-head img { flex: none; filter: drop-shadow(0 4px 10px rgba(168,85,247,.45)); }
.tfx-coach-name { font-weight: 800; color: #d8b4fe; }
.tfx-coach-count { font-size: .8rem; color: #b9a8d6; }
.tfx-coach-dots { display: flex; gap: 6px; margin: 10px 0 4px; }
.tfx-coach-dots span { flex: 1; height: 4px; border-radius: 4px; background: rgba(255,255,255,.14); }
.tfx-coach-dots span.on { background: linear-gradient(90deg,#f5c542,#e0a400); }
.tfx-coach-text { font-size: 1.08rem; line-height: 1.6; margin: 10px 0 14px; }
.tfx-coach-text small { color: #b9a8d6; font-size: .82rem; }
.tfx-coach-text .lux-ico { color: #6db3ff; }
.tfx-coach-btns { display: flex; gap: 8px; }
.tfx-coach-btns button { flex: 1; min-height: 46px; border-radius: 12px; font: inherit; font-weight: 700; cursor: pointer; }
.tfx-coach-next { background: linear-gradient(180deg,#f7d264,#e0a400); color: #1a1205; border: 0; }
.tfx-coach-back { flex: 0 0 auto !important; padding: 0 14px; background: transparent; color: #e9e2f7; border: 1px solid rgba(255,255,255,.22); }
.tfx-coach-alt { display: block; text-align: center; margin-top: 12px; font-size: .88rem; color: #7dd3fc; text-decoration: underline; }
@media (prefers-reduced-motion: reduce) { .tfx-coach-arrow { animation: none; } }

/* [ต.ค. 2026] ป้าย VIP บนแถบหัว + แบนเนอร์ชวนสมัคร VIP */
.vip-badge { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 800; color: #1a1205;
  background: var(--lux-gold-grad); padding: 5px 12px; border-radius: 999px; text-decoration: none; white-space: nowrap; }
.vip-upsell { display: flex; align-items: center; gap: 12px; margin: 14px 0; padding: 14px 16px; border-radius: 16px; text-decoration: none;
  background: radial-gradient(120% 120% at 0% 0%, rgba(217,180,90,.22), transparent 60%), linear-gradient(180deg,#1d1810,#121016);
  border: 1px solid rgba(217,180,90,.55); color: #efe7d6; }
.vip-upsell b { color: #f9e8b6; }
.vip-upsell-ico { font-size: 1.6rem; flex: none; }
.vip-upsell-text { flex: 1; min-width: 0; font-size: .9rem; line-height: 1.5; }
.vip-upsell-go { flex: none; font-size: .85rem; font-weight: 800; color: #1a1205; background: var(--lux-gold-grad); padding: 8px 12px; border-radius: 10px; }
.ep-tag-vip { background: rgba(217,180,90,.16); color: #f9e8b6; border: 1px solid rgba(217,180,90,.5); }
.vip-screen-block { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 20px; text-align: center; background: rgba(8,6,12,.92); color: #efe7d6; }
.vip-screen-block b { color: #f9e8b6; font-size: 1.05rem; }

/* ----------------------------------------------------------------------------
   [ต.ค. 2026] แถบบนมือถือแบบกะทัดรัด + แถบทางลัดเล็ก + กล่องรับพอยต์แบบพรีเมียม
   ---------------------------------------------------------------------------- */
.coin-link { text-decoration: none; cursor: pointer; }
.acct-btn .acct-icon { display: none; }
.m-quickbar { display: none; }
.tfx-toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 3000;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: 14px; font-size: .92rem; font-weight: 700; color: #1a1205;
  background: var(--lux-gold-grad); box-shadow: 0 12px 30px rgba(0,0,0,.5); transition: opacity .2s ease, transform .2s ease; }
.tfx-toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 640px) {
  .topnav { row-gap: 8px; }
  .topnav .home-shortcut { display: none; }            /* แตะโลโก้ = กลับหน้าแรก */
  .topnav .fortune-link { font-size: .8rem; }
  .topnav .nav-right { flex-wrap: nowrap; gap: 6px; }
  .topnav .nav-right .nav-sc,
  .topnav .nav-right .nav-topup,
  .topnav .nav-right .vip-badge { display: none; }
  .topnav .nav-right .coin-link { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; padding: .3rem .35rem .3rem .6rem; }
  .topnav .nav-right .coin-link::after { content: "+"; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
    font-weight: 900; font-size: .85rem; line-height: 1; color: #1a1205; background: #f5c542; margin-left: 2px; }
  .acct-btn .acct-full { display: none; }
  .acct-btn .acct-icon { display: inline; font-size: 1.05rem; line-height: 1; }
  .topnav .nav-right .acct-btn { padding: .4rem .6rem; }
  .m-quickbar { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 10px 16px 2px; -webkit-overflow-scrolling: touch; }
  .m-quickbar::-webkit-scrollbar { display: none; }
  .mq-chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; padding: 7px 12px; border-radius: 999px; white-space: nowrap;
    font: inherit; font-size: .8rem; font-weight: 700; text-decoration: none; cursor: pointer; border: 1px solid; background: transparent; }
  .mq-green { color: #4ade80; border-color: rgba(74,222,128,.45); background: rgba(74,222,128,.08); }
  .mq-gold { color: #f9e8b6; border-color: rgba(217,180,90,.55); background: rgba(217,180,90,.1); }
  .mq-gold.is-done { color: #a9a3b5; border-color: rgba(255,255,255,.15); background: transparent; }
  .mq-teal { color: #5eead4; border-color: rgba(94,234,212,.45); background: rgba(94,234,212,.08); }
  .mq-vip { color: #1a1205; border-color: transparent; background: var(--lux-gold-grad); }
}

/* กล่องรับพอยต์ฟรี + เช็คอิน (หน้าแรก) */
.pts-panel { display: none; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 8px; }
/* [ต.ค. 2026] ทุกขนาดจอ: ซ่อนไว้ก่อน เปิดเมื่อกดปุ่ม "รับพอยต์ฟรี" ที่แถบบน (หน้าแรกโล่งขึ้น) */
.pts-panel.m-open:not([hidden]) { display: grid; }
.pts-panel[hidden] { display: none; }
.pts-card { position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 18px;
  background: radial-gradient(120% 140% at 0% 0%, rgba(217,180,90,.16), transparent 55%), linear-gradient(180deg,#18161d,#111016);
  border: 1px solid rgba(217,180,90,.32); }
.pts-ico { flex: none; width: 48px; height: 48px; display: grid; place-items: center; font-size: 1.5rem; border-radius: 14px;
  background: rgba(217,180,90,.12); border: 1px solid rgba(217,180,90,.35); }
.pts-body { flex: 1; min-width: 0; }
.pts-title { font-weight: 800; color: #fff; font-size: .98rem; }
.pts-sub { color: #a9a3b5; font-size: .82rem; margin-top: 3px; line-height: 1.45; }
.pts-btn { flex: none; min-height: 40px; padding: 0 14px; border: 0; border-radius: 12px; cursor: pointer; font: inherit; font-weight: 800; font-size: .86rem;
  color: #1a1205; background: var(--lux-gold-grad); box-shadow: 0 6px 18px rgba(217,180,90,.22); white-space: nowrap; }
.pts-btn:disabled { color: #a9a3b5; background: rgba(255,255,255,.07); box-shadow: none; cursor: default; }
@media (max-width: 900px) and (min-width: 641px) { .pts-panel { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  /* มือถือ: ซ่อนไว้ (มีปุ่มเล็ก "รับพอยต์ฟรี" / "เช็คอิน" ใต้แถบบนแทน) — เปิดเมื่อกดปุ่มรับพอยต์ฟรี */
  .pts-panel { grid-template-columns: 1fr; }
  .pts-card { padding: 14px; }
  .pts-btn { padding: 0 12px; }
}

/* [ต.ค. 2026] กล่องต้อนรับ: พรีเซนเตอร์คู่ (บอล + ทีมงาน) */
.lux-duo .lux-person-img.lux-duo-l { left: 64%; height: 236px; z-index: 1; }   /* บอล ขวา */
.lux-duo .lux-person-img.lux-duo-r { left: 24%; top: 40px; height: 250px; z-index: 0; }  /* นิศา ซ้าย (ครึ่งตัว) */
.lux-person.lux-duo { height: 250px; }
.lux-duo .lux-person-badge { top: 44px; bottom: auto; width: 40px; height: 40px; border-radius: 11px; }
.lux-duo .lux-person-img.lux-duo-l { height: 262px; }

/* [ต.ค. 2026 รอบสมาชิกใหม่] VIP / VVIP / พรีเมี่ยม / ไม่ดูโฆษณา */
.vip-badge--vvip { color: #12091f; background: linear-gradient(135deg,#ede9fe,#a78bfa 55%,#7c3aed); }
.series-card .badge-premium {
  position: absolute; left: 6px; bottom: 6px;
  font-size: 0.66rem; font-weight: 800; line-height: 1;
  color: #12091f; background: linear-gradient(135deg,#ede9fe,#a78bfa 60%,#8b5cf6);
  padding: 4px 7px; border-radius: 999px; box-shadow: 0 2px 8px rgba(0,0,0,.45);
}
html.tfx-noads .ad-slot,
html.tfx-noads .inline-ad-mobile { display: none !important; }
.ep-tag-vvip { color: #12091f; background: linear-gradient(135deg,#ede9fe,#a78bfa); }
.ep-tag-prem { color: #ede9fe; background: rgba(167,139,250,.18); border: 1px solid rgba(167,139,250,.45); }
.prem-box { display: flex; align-items: center; gap: 12px; margin: 14px 0; padding: 14px 16px; border-radius: 16px;
  background: radial-gradient(120% 120% at 0% 0%, rgba(167,139,250,.22), transparent 60%), linear-gradient(180deg,#171226,#100d18);
  border: 1px solid rgba(167,139,250,.55); color: #ede9fe; }
.prem-box-ico { font-size: 1.6rem; flex: none; }
.prem-box-text { flex: 1; min-width: 0; font-size: .92rem; line-height: 1.5; }
.prem-box-text b { color: #fff; }
.prem-box .btn-prem { flex: none; border: 0; border-radius: 12px; padding: 10px 14px; font: inherit; font-weight: 800; cursor: pointer;
  color: #12091f; background: linear-gradient(135deg,#ede9fe,#a78bfa 55%,#7c3aed); text-decoration: none; white-space: nowrap; }
.prem-box .btn-prem:disabled { opacity: .6; cursor: default; }

/* [ต.ค. 2026 รอบ 2] หนังจากครีเอเตอร์ (YouTube) */
.cr-card { display: flex; flex-direction: column; color: inherit; text-decoration: none; background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: 14px; overflow: hidden; transition: transform .15s ease; flex: none; }
.cr-card:hover { transform: translateY(-3px); }
.cr-thumb { position: relative; aspect-ratio: 4 / 5; background: #111018; overflow: hidden; }
.cr-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cr-free { position: absolute; top: 6px; left: 6px; font-size: .66rem; font-weight: 800; color: #052e16; background: #4ade80; padding: 3px 7px; border-radius: 999px; }
.cr-eps { position: absolute; right: 6px; bottom: 6px; font-size: .66rem; font-weight: 800; color: #fff; background: rgba(0,0,0,.65); padding: 3px 7px; border-radius: 999px; }
.cr-body { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; min-width: 0; }
.cr-name { font-weight: 700; font-size: .88rem; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-by { font-size: .74rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-views { font-size: .72rem; color: var(--text-muted); }
.rail-track .cr-card { width: 160px; }
@media (max-width: 480px) { .rail-track .cr-card { width: 38vw; max-width: 165px; } }
.cr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
@media (max-width: 760px) { .topnav .creators-shortcut { display: none; } }

/* [ต.ค. 2026] แบนเนอร์โปรโมชันของเว็บเอง (หมุนสุ่ม) ในหน้าอื่นนอกจากหน้าแรก */
.house-strip { position: relative; display: block; max-width: 760px; margin: 18px auto; border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.08); text-decoration: none; transition: transform .18s ease, filter .18s ease; }
.house-strip:hover { transform: translateY(-2px); filter: brightness(1.06); }
.house-strip img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; object-fit: cover; }
.house-strip::after { content: "แนะนำ"; position: absolute; top: 6px; right: 8px; font-size: .6rem; color: #fff; background: rgba(0,0,0,.5); padding: 2px 6px; border-radius: 6px; }
html.tfx-noads .house-strip { display: none !important; }
.house-strip[hidden] { display: none; }

/* [ต.ค. 2026 รอบ 3] Pre-roll โฆษณาก่อนหนัง */
.tfx-preroll { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(80% 60% at 50% 40%, #1b1626, #07060b); animation: tfxFadeIn .25s ease; }
.tfx-preroll.is-out { opacity: 0; transition: opacity .25s ease; }
.tfx-preroll-ad { display: block; width: 100%; height: 100%; }
.tfx-preroll-ad img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tfx-preroll-tag { position: absolute; top: 10px; left: 10px; font-size: .72rem; font-weight: 800; color: #1a1205; background: #f5c542; padding: 3px 8px; border-radius: 6px; }
.tfx-preroll-skip { position: absolute; right: 10px; top: 10px; min-height: 40px; padding: 0 16px; border-radius: 10px; font: inherit; font-weight: 800; font-size: .9rem;
  color: #fff; background: rgba(0,0,0,.72); border: 1px solid rgba(255,255,255,.35); cursor: pointer; }
.tfx-preroll-skip:disabled { cursor: default; opacity: .85; }
.tfx-preroll-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.12); }
.tfx-preroll-bar i { display: block; height: 100%; width: 0; background: #f5c542; transition: width .2s linear; }
@keyframes tfxFadeIn { from { opacity: 0; } to { opacity: 1; } }
