/* 037HD Reels — dark cinema layout with gold accent; banner slots follow 772×200 / 728×200 / 200×580. */
:root {
  --bg: #0b0c10; --surface: #15171d; --raised: #1d2028; --line: #2a2e38;
  --text: #f2f3f5; --muted: #9ba2ae; --gold: #ffb000; --gold-2: #ffcf4d; --red: #ff3355;
  --radius: 10px; --head: 64px; --wrap: 1180px;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 Sarabun, "Leelawadee UI", "Noto Sans Thai", system-ui, sans-serif; }
h1, h2, h3, .btn, .site-nav, .sec-title { font-family: Kanit, Sarabun, system-ui, sans-serif; line-height: 1.3; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--gold-2); }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.wrap { width: min(100% - 24px, var(--wrap)); margin-inline: auto; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 12px; top: 12px; z-index: 99; background: var(--gold); color: #111; padding: 8px 12px; border-radius: 8px; }

/* Header */
.site-head { position: sticky; top: 0; z-index: 50; background: rgba(11, 12, 16, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.head-row { height: var(--head); display: flex; align-items: center; gap: 18px; }
.logo img { height: 40px; width: auto; }
.site-nav { display: flex; align-items: center; gap: 4px; font-weight: 500; font-size: 15px; }
.site-nav > a, .drop > button { padding: 8px 12px; border-radius: 8px; color: #e6e7ea; background: none; border: 0; font: inherit; cursor: pointer; }
.site-nav > a:hover, .drop > button:hover { background: var(--raised); color: var(--gold-2); }
.nav-ad { color: var(--gold) !important; }
.drop { position: relative; }
.drop-menu { display: none; position: absolute; top: 100%; left: 0; min-width: 220px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 18px 40px rgba(0,0,0,.5); }
.drop-menu a { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 6px; font-size: 14px; }
.drop-menu a:hover { background: var(--raised); }
.drop-menu small { color: var(--muted); }
.drop-cols { display: none; grid-template-columns: repeat(2, minmax(150px, 1fr)); width: 360px; }
.drop:hover .drop-menu, .drop.open .drop-menu { display: block; }
.drop:hover .drop-cols, .drop.open .drop-cols { display: grid; }
.search { margin-left: auto; display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.search input { width: 200px; padding: 8px 14px; background: none; border: 0; color: var(--text); font: inherit; font-size: 14px; }
.search input:focus { outline: none; }
.search button { border: 0; background: var(--gold); color: #141414; width: 40px; font-size: 18px; cursor: pointer; }
.search-big { margin: 0 0 24px; max-width: 640px; }
.search-big input { width: 100%; padding: 12px 18px; font-size: 16px; }
.search-big button { width: auto; padding: 0 22px; font-weight: 700; font-family: Kanit, sans-serif; }
.nav-toggle { display: none; margin-left: auto; width: 42px; height: 42px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; flex-direction: column; justify-content: center; gap: 4px; align-items: center; cursor: pointer; }
.nav-toggle span { width: 18px; height: 2px; background: var(--text); }

/* Ad slots */
.ad-top { padding-top: 10px; }
.ad-slot { margin: 10px auto; max-width: var(--ad-w); }
.ad-stack { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ad-item { display: block; width: 100%; max-width: var(--ad-w); }
.ad-item img { width: 100%; aspect-ratio: var(--ad-w) / var(--ad-h); object-fit: cover; border-radius: 6px; }
.ad-empty { display: grid; place-content: center; text-align: center; width: 100%; aspect-ratio: var(--ad-w) / var(--ad-h); max-height: 120px; border: 1px dashed #3b404c; border-radius: 8px; color: var(--muted); font-family: Kanit, sans-serif; background: repeating-linear-gradient(135deg, #12141a 0 12px, #15171e 12px 24px); }
.ad-empty span { color: var(--gold); font-size: 15px; } .ad-empty small { font-size: 12px; }
.ad-side_left_200 .ad-empty, .ad-side_right_200 .ad-empty { max-height: none; }
.rail { position: fixed; top: calc(var(--head) + 14px); width: 200px; z-index: 20; display: none; }
.rail .ad-slot { margin: 0; }
.rail-left { left: calc(50% - var(--wrap) / 2 - 216px); }
.rail-right { right: calc(50% - var(--wrap) / 2 - 216px); }
@media (min-width: 1640px) { .rail { display: block; } }

/* Home hero and sections */
.main { padding-bottom: 24px; min-height: 60vh; }
.hero { padding: 18px 0 6px; }
.hero h1 { margin: 0 0 6px; font-size: clamp(22px, 3.2vw, 32px); font-weight: 800; }
.hero h1 span { display: block; font-size: .62em; font-weight: 500; color: var(--gold-2); }
.hero p { margin: 0 0 14px; color: var(--muted); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.chips::-webkit-scrollbar { display: none; }
.chips a { flex: none; padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-family: Kanit, sans-serif; }
.chips a:hover { border-color: var(--gold); }
.chips small { color: var(--muted); }
.sec { margin: 26px 0; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; border-left: 4px solid var(--gold); padding-left: 10px; }
.sec-title { margin: 0; font-size: 20px; font-weight: 700; }
.sec-more { color: var(--gold); font-size: 14px; white-space: nowrap; }

/* Poster grid */
.grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px 12px; }
.card { display: block; }
.card-img { position: relative; display: block; aspect-ratio: 2 / 3; overflow: hidden; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.card:hover .card-img img { transform: scale(1.04); }
.card-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 7px; font-size: 14px; font-weight: 600; line-height: 1.4; }
.tag { position: absolute; padding: 2px 7px; border-radius: 5px; font-size: 11px; font-weight: 700; font-family: Kanit, sans-serif; }
.tag-src { left: 6px; top: 6px; background: rgba(11,12,16,.82); color: var(--gold-2); }
.tag-new { right: 6px; top: 6px; background: var(--red); color: #fff; }
.tag-lang { right: 6px; bottom: 6px; background: #2563eb; color: #fff; }
.rank { position: absolute; left: 6px; bottom: -6px; font: italic 900 46px/1 Kanit, sans-serif; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.8); }
.empty { color: var(--muted); padding: 20px 0; }

/* Title page */
.crumbs { font-size: 13px; color: var(--muted); padding: 14px 0 0; }
.crumbs a:hover { color: var(--gold-2); }
.title-top { display: grid; grid-template-columns: 300px 1fr; gap: 28px; margin: 16px 0 24px; }
.title-poster img { width: 300px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0,0,0,.55); }
.title-info h1, .watch-page h1 { margin: 0 0 12px; font-size: clamp(22px, 3vw, 32px); font-weight: 800; }
.title-info h1 span, .watch-page h1 span { color: var(--gold-2); font-size: .7em; font-weight: 500; }
.facts { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; font-size: 15px; }
.facts b { display: inline-block; min-width: 92px; color: var(--muted); font-weight: 600; }
.facts a { color: var(--gold-2); margin-right: 6px; }
.h-syn { font-size: 17px; margin: 14px 0 6px; }
.synopsis { color: #dfe1e6; margin: 0 0 18px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 20px; border-radius: 10px; font-weight: 700; border: 1px solid transparent; }
.btn-primary { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #151515; }
.btn-primary:hover { color: #000; filter: brightness(1.06); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.note { padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--gold-2); }
.player-zone { margin: 8px 0 24px; }
.player-zone .sec-title { margin: 10px 0; text-align: center; }

/* Player */
.hdp { position: relative; width: min(100%, 420px); margin: 0 auto; aspect-ratio: 9 / 16; background: #000; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.hdp video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.hdp-start { position: absolute; inset: 0; display: grid; place-content: center; gap: 8px; background: radial-gradient(circle, rgba(0,0,0,.15), rgba(0,0,0,.55)); border: 0; color: #fff; cursor: pointer; font-family: Kanit, sans-serif; }
.hdp-start span { display: grid; place-items: center; width: 78px; height: 78px; margin: auto; border-radius: 50%; background: var(--gold); color: #141414; font-size: 30px; padding-left: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.hdp-start em { font-style: normal; font-size: 15px; }
.hdp-start[hidden] { display: none; }
.hdp-ad { position: absolute; inset: auto 0 0; display: flex; align-items: center; gap: 8px; padding: 10px; background: linear-gradient(transparent, rgba(0,0,0,.75)); }
.hdp-ad[hidden] { display: none; }
.hdp-badge { background: var(--gold); color: #141414; font: 700 12px Kanit, sans-serif; padding: 2px 8px; border-radius: 4px; }
.hdp-count { color: #ddd; font-size: 13px; }
.hdp-visit, .hdp-skip { border: 0; border-radius: 8px; padding: 8px 12px; font: 600 13px Kanit, sans-serif; cursor: pointer; }
.hdp-visit { margin-left: auto; background: rgba(255,255,255,.14); color: #fff; }
.hdp-visit[hidden] { display: none; }
.hdp-skip { background: #fff; color: #111; }
.hdp-skip:disabled { background: rgba(255,255,255,.25); color: #ddd; cursor: default; }
.hdp-unmute { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); border: 0; border-radius: 999px; padding: 8px 14px; background: rgba(0,0,0,.7); color: #fff; font: 600 14px Kanit, sans-serif; cursor: pointer; }
.hdp-unmute[hidden] { display: none; }
.hdp-end { position: absolute; inset: 0; display: grid; place-content: center; gap: 12px; padding: 20px; text-align: center; background: rgba(0,0,0,.82); }
.hdp-end[hidden] { display: none; }
.watch-page .hdp { margin-top: 6px; }
.ep-nav { display: flex; justify-content: space-between; gap: 10px; max-width: 420px; margin: 14px auto; }
.locked { max-width: 420px; margin: 0 auto; padding: 28px 20px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }

/* Episodes */
.episodes { margin: 24px 0; }
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; margin: 12px 0 6px; }
.ep { display: grid; place-items: center; height: 42px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-family: Kanit, sans-serif; }
.ep:hover { border-color: var(--gold); }
.ep.is-current { background: var(--gold); color: #141414; border-color: var(--gold); }
.ep-lock { color: var(--muted); position: relative; }
.ep-lock::after { content: "🔒"; position: absolute; top: 1px; right: 3px; font-size: 9px; }

/* FAQ, about, lists */
.faq { margin: 28px 0; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 8px; }
.faq summary { cursor: pointer; padding: 13px 16px; font-weight: 600; font-family: Kanit, sans-serif; }
.faq p { margin: 0; padding: 0 16px 14px; color: #d6d8dd; }
.about { margin: 30px 0; padding: 20px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.about h2 { margin: 0 0 8px; font-size: 20px; }
.about p { color: #d6d8dd; }
.list-head { padding: 16px 0 10px; }
.list-head h1 { margin: 0 0 6px; font-size: clamp(22px, 3vw, 30px); }
.list-head h1 span { color: var(--muted); font-size: .6em; }
.list-head p { margin: 0; color: #d6d8dd; }
.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 26px 0; }
.pager a, .pager span { min-width: 42px; padding: 8px 12px; text-align: center; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.pager span { background: var(--gold); color: #141414; font-weight: 700; }
.notfound { text-align: center; padding: 40px 0 10px; }
.notfound .search-big { margin: 18px auto; }
.prose { max-width: 820px; margin: 20px auto; }
.prose table { width: 100%; border-collapse: collapse; margin: 14px 0; }
.prose th, .prose td { border: 1px solid var(--line); padding: 10px; text-align: left; }
.prose th { background: var(--surface); }
.posts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.post-card { padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }

/* Footer */
.site-foot { margin-top: 30px; border-top: 1px solid var(--line); background: #08090c; }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 28px; padding: 30px 0 12px; }
.foot-grid p { color: #c9ccd2; font-size: 14px; }
.foot-grid h2 { font-size: 15px; margin: 0 0 10px; color: var(--gold-2); }
.foot-grid nav a, .foot-grid nav li { display: block; color: #c9ccd2; font-size: 14px; padding: 3px 0; list-style: none; }
.copy { padding: 12px 0 24px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }

/* Responsive */
@media (max-width: 1100px) { .grid { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 960px) {
  .nav-toggle { display: flex; }
  .site-nav { display: none; position: absolute; top: var(--head); left: 0; right: 0; flex-direction: column; align-items: stretch; padding: 10px 12px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
  .site-nav.open { display: flex; }
  .drop-menu, .drop-cols { position: static; box-shadow: none; width: auto; }
  .search { display: none; }
  .site-nav.open + .search { display: flex; }
  .grid { grid-template-columns: repeat(4, 1fr); }
  .foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 12px 8px; }
  .card-title { font-size: 13px; }
  .title-top { grid-template-columns: 120px 1fr; gap: 14px; }
  .title-poster img { width: 120px; }
  .facts b { min-width: 0; margin-right: 4px; }
  .synopsis, .h-syn, .actions { grid-column: 1 / -1; }
  .posts { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr; }
  .rank { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
