/* TV24X Premium UI — layering on top of the existing design */
:root {
  --bg: #08080a;
  --surface: #101013;
  --surface-2: #17171b;
  --line: rgba(231, 199, 180, .26);
  --line-soft: rgba(231, 199, 180, .12);
  --gold: #e7c7b4;
  --gold-2: #f3d7c8;
  --red: #e10600;
  --text: #f7f4f0;
  --muted: #b7b1aa;
  --dim: #8b857f;
  --latin: "Manrope", "Noto Sans Thai", sans-serif;
  --shadow: 0 22px 60px rgba(0, 0, 0, .42);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, .28);
  --r: 16px;
}

html { scroll-behavior: smooth; }
body {
  background:
    radial-gradient(900px 380px at 0% -8%, rgba(225, 6, 0, .12), transparent 64%),
    radial-gradient(820px 420px at 100% 0%, rgba(231, 199, 180, .09), transparent 62%),
    var(--bg);
  font-family: "Noto Sans Thai", "Manrope", sans-serif;
  letter-spacing: .003em;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: .028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}
::selection { background: rgba(243, 215, 200, .28); color: #fff; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; }

/* typography */
h1, .hero h1, .film h1 { letter-spacing: -.025em; }
.sec b { font-size: 20px; font-weight: 700; letter-spacing: -.015em; }
.sec { margin: 28px 0 14px; align-items: end; }
.sec span { letter-spacing: .02em; }
.eyebrow {
  display: block;
  margin: 0 0 5px;
  color: var(--gold-2);
  font-family: var(--latin);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .22em;
  text-transform: uppercase;
}
.num, time, .scorechip b, .fix-clock strong, .pay-amount, .price strong { font-family: var(--latin); font-variant-numeric: tabular-nums; }

/* header */
.head {
  transition: background .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.head.scrolled {
  background: rgba(8, 8, 10, .92);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .32);
  border-bottom-color: rgba(231, 199, 180, .18);
}
.head.scrolled .top { height: 64px; }
.head.scrolled .logo, .head.scrolled .logo img { height: 54px; }
.head.scrolled .cmenu a { padding-top: 8px; padding-bottom: 10px; }
.top { transition: height .25s ease; }
.account-wrap { position: relative; display: flex; align-items: center; gap: 8px; }
.account-wrap .search-d { display: grid; }
.account-wrap .quiet { color: #d4cdc6; font-size: 14px; font-weight: 500; min-height: 38px; display: inline-flex; align-items: center; padding: 0; }
.account-wrap .quiet:hover, .account-wrap .quiet.on { color: var(--gold-2); }
.account-wrap .vipcard { appearance: none; text-align: left; cursor: pointer; font: inherit; }
.vipcard { transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.vipcard:hover { transform: translateY(-1px); border-color: rgba(243, 215, 200, .9); }
.vipcard.expired { border-color: rgba(225, 6, 0, .5); background: linear-gradient(180deg, rgba(225, 6, 0, .16), rgba(16, 16, 18, .08)); }
.vipcard.expired .vipcopy small { color: #ffb4a8; }
.account-menu {
  position: absolute;
  z-index: 60;
  top: calc(100% + 10px);
  right: 0;
  width: 262px;
  padding: 10px;
  border: 1px solid rgba(231, 199, 180, .26);
  border-radius: 18px;
  background: linear-gradient(180deg, #17171b, #0f0f12);
  box-shadow: var(--shadow);
}
.account-menu[hidden] { display: none; }
.account-menu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}
.account-menu-head b { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.account-menu-head small { display: block; margin-top: 2px; color: var(--gold-2); font-size: 12px; }
.account-menu .am-link, .account-menu .am-out {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #e8e3de;
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.account-menu .am-link:hover, .account-menu .am-out:hover { background: rgba(231, 199, 180, .08); color: #fff; }
.account-menu .am-out { color: #ffb4a8; }
.account-menu .am-admin { color: var(--gold-2); }

/* mobile account sheet */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, .66);
}
.sheet-mask[hidden] { display: none; }
.account-sheet {
  width: min(560px, 100%);
  max-height: min(78vh, 620px);
  max-height: min(78dvh, 620px);
  overscroll-behavior: contain;
  overflow: auto;
  padding: 8px 18px calc(18px + env(safe-area-inset-bottom));
  border: 1px solid rgba(231, 199, 180, .3);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, #19191d, #0d0d10);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .45);
  animation: sheetUp .28s cubic-bezier(.2, .8, .2, 1);
}
.sheet-grab { width: 38px; height: 4px; margin: 2px auto 12px; border-radius: 99px; background: rgba(255, 255, 255, .2); }
.account-sheet-head { display: flex; align-items: center; gap: 12px; padding: 0 2px 14px; border-bottom: 1px solid var(--line-soft); }
.account-sheet-head b { display: block; max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.account-sheet-head small { display: block; margin-top: 3px; color: var(--gold-2); font-size: 13px; }
.account-sheet .sheet-link, .account-sheet .sheet-out {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  padding: 0 4px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  background: transparent;
  color: #eee9e4;
  font: inherit;
  font-size: 15px;
  text-align: left;
}
.account-sheet .sheet-link:hover, .account-sheet .sheet-out:hover { color: var(--gold-2); }
.account-sheet .sheet-out { color: #ffb4a8; border-bottom: 0; }
.account-sheet .sheet-close { width: 100%; height: 46px; margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .03); color: var(--gold-2); font: inherit; cursor: pointer; }
@keyframes sheetUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* search overlay */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 96;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(64px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom));
  background: rgba(5, 5, 7, .96);
  backdrop-filter: blur(10px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.search-overlay[hidden] { display: none; }
@media (max-width: 899px) {
  .search-overlay { padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); }
}
.search-shell { width: min(720px, 100%); }
.search-kicker { margin: 0 0 10px; color: var(--gold-2); font-family: var(--latin); font-size: 11px; font-weight: 800; letter-spacing: .22em; }
.search-form { display: flex; gap: 8px; }
.search-form input { flex: 1; height: 58px; padding: 0 18px; border: 1px solid rgba(231, 199, 180, .34); border-radius: 14px; background: #121214; color: #fff; font-size: 18px; outline: 0; }
.search-form input:focus { border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(243, 215, 200, .1); }
.search-form button { height: 58px; padding: 0 22px; border: 0; border-radius: 14px; background: linear-gradient(180deg, #f3d7c8, #e0b39a); color: #2a1612; font: inherit; font-weight: 800; cursor: pointer; }
.search-filters { display: flex; gap: 8px; margin-top: 16px; overflow-x: auto; scrollbar-width: none; }
.search-filters::-webkit-scrollbar { display: none; }
.search-filter { flex: 0 0 auto; height: 38px; padding: 0 14px; border: 1px solid var(--line-soft); border-radius: 999px; background: transparent; color: #ddd7d1; font: inherit; font-size: 13px; cursor: pointer; }
.search-filter.on { border-color: transparent; background: linear-gradient(180deg, var(--gold-2), #e0b39a); color: #2a1612; font-weight: 700; }
.search-recent { margin-top: 20px; }
.search-recent .recent-title { display: block; margin-bottom: 8px; color: var(--dim); font-size: 12px; }
.search-recent .recent-list { display: flex; flex-wrap: wrap; gap: 8px; }
.search-recent .recent-chip { min-height: 38px; padding: 0 12px; border: 1px solid var(--line-soft); border-radius: 999px; background: transparent; color: #ddd7d1; font: inherit; font-size: 13px; cursor: pointer; }
.search-recent .recent-chip:hover { border-color: var(--line); color: #fff; }
.search-results { display: grid; gap: 8px; margin-top: 20px; }
.search-result { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid rgba(231, 199, 180, .12); border-radius: 12px; background: rgba(255, 255, 255, .025); }
.search-result:hover { border-color: rgba(231, 199, 180, .4); background: rgba(231, 199, 180, .06); }
.search-result img { width: 46px; height: 66px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; }
.search-result b { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.search-result small { display: block; margin-top: 3px; color: var(--gold-2); font-size: 12px; }
.search-empty { margin: 18px 0 0; color: var(--muted); font-size: 14px; text-align: center; }
.search-close { position: absolute; top: max(22px, env(safe-area-inset-top)); right: 18px; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, .03); color: var(--gold-2); font: inherit; cursor: pointer; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 100;
  max-width: min(92vw, 420px);
  padding: 12px 18px;
  border: 1px solid rgba(231, 199, 180, .35);
  border-radius: 999px;
  background: rgba(18, 18, 21, .96);
  box-shadow: var(--shadow-soft);
  color: #f6f3ef;
  font-size: 14px;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 18px);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.good { border-color: rgba(74, 222, 128, .35); }
.toast.bad { border-color: rgba(225, 6, 0, .45); }

/* hero slider */
.hero-slider { position: relative; min-height: 460px; margin: 0 0 28px; overflow: hidden; border-radius: 24px; background: #0b0b0d; box-shadow: var(--shadow); }
.hero-slide { position: absolute; inset: 0; min-height: 460px; margin: 0; border-radius: 0; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .9s ease, visibility .9s ease; }
.hero-slide.on { opacity: 1; visibility: visible; pointer-events: auto; }
.hero-slide .hero-bg { transform: scale(1.05); }
.hero-slide.on .hero-bg { animation: heroZoom 14s ease-out both; }
@keyframes heroZoom { from { transform: scale(1.05); } to { transform: scale(1.11); } }
.hero-slide .hero-shade { background: linear-gradient(90deg, rgba(8, 8, 10, .94) 0%, rgba(8, 8, 10, .58) 48%, rgba(8, 8, 10, .08) 100%); }
.hero-slide .hero-copy { max-width: 620px; }
.hero-slide .hero-kicker { letter-spacing: .2em; }
.hero-slide h1 {
  font-size: clamp(30px, 4.2vw, 46px);
  line-height: 1.18;
  max-width: 18ch;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-dots { position: absolute; right: 22px; bottom: 18px; z-index: 3; display: flex; gap: 7px; }
.hero-dot { width: 24px; height: 3px; border: 0; border-radius: 99px; background: rgba(255, 255, 255, .24); cursor: pointer; transition: width .2s ease, background .2s ease; }
.hero-dot.on { width: 44px; background: var(--gold-2); }

/* home rails / continue / watchlist */
.home-block { margin-top: 8px; }
.rail-cards { display: grid; grid-auto-flow: column; grid-auto-columns: 148px; gap: 12px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.rail-cards::-webkit-scrollbar { display: none; }
.continue-card, .watch-card { display: flex; flex-direction: column; gap: 6px; scroll-snap-align: start; min-width: 0; }
.continue-card .shot, .watch-card .shot { position: relative; aspect-ratio: 2/3; overflow: hidden; border-radius: 12px; background: #141416; }
.continue-card .shot img, .watch-card .shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.continue-card .progress { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 3px; border-radius: 99px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.continue-card .progress i { display: block; height: 100%; background: var(--gold-2); }
.continue-card b, .watch-card b { font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.continue-card small, .watch-card small { color: var(--dim); font-size: 11px; }
.watch-card .remove-watch { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 999px; background: rgba(8, 8, 10, .72); color: #fff; font: inherit; line-height: 1; cursor: pointer; }
@media (min-width: 900px) {
  .rail-cards { grid-auto-columns: 178px; }
  .continue-card .shot, .watch-card .shot { border-radius: 14px; }
}

/* poster cards */
.poster .shot {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(100deg, #141416 28%, #1d1d21 48%, #141416 68%);
  background-size: 220% 100%;
  animation: shimmer 1.6s linear infinite;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .18);
}
@keyframes shimmer { from { background-position: 180% 0; } to { background-position: -80% 0; } }
.poster .shot img { width: 100%; height: 100%; object-fit: cover; display: block; animation: none; }
.poster.wide .shot { aspect-ratio: 5/4; background: radial-gradient(120% 80% at 50% 0%, rgba(231, 199, 180, .12), transparent 58%), #121214; animation: none; }
.poster.wide .shot img { object-fit: contain; padding: 12px; }
.poster .cap { padding-top: 8px; }
.poster .cap b { font-size: 14px; font-weight: 600; line-height: 1.35; }
.poster .cap small { display: block; margin-top: 3px; color: var(--dim); font-size: 11px; }
.poster .play-hover {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  opacity: 0;
  background: radial-gradient(60% 50% at 50% 50%, rgba(0, 0, 0, .38), transparent 70%);
  transition: opacity .2s ease;
  pointer-events: none;
}
.poster .play-hover span { width: 54px; height: 54px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .5); border-radius: 999px; background: rgba(8, 8, 10, .5); color: #fff; backdrop-filter: blur(6px); }
.poster:hover .play-hover { opacity: 1; }
.poster:hover .shot img { transform: scale(1.035); }
.poster .shot img { transition: transform .45s ease; }
@media (hover: none) {
  .poster .play-hover { display: none; }
  .poster:active { transform: scale(.985); }
}

/* badges */
.marks { padding-top: 26px; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .78)); }
.mark {
  height: 21px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(8, 8, 10, .68);
  box-shadow: none;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .01em;
  backdrop-filter: blur(6px);
}
.mark.dub { border-color: rgba(225, 6, 0, .5); background: linear-gradient(180deg, rgba(255, 77, 66, .9), rgba(170, 5, 0, .92)); }
.mark.sub { border-color: rgba(225, 6, 0, .32); background: rgba(12, 12, 14, .8); }
.mark.q { color: var(--gold-2); background: rgba(20, 20, 24, .78); }
.scorechip { top: 8px; right: 8px; padding: 4px 7px 5px; border-radius: 7px; border-color: rgba(231, 199, 180, .3); background: rgba(8, 8, 10, .72); backdrop-filter: blur(6px); }
.scorechip small { font-size: 8px; letter-spacing: .04em; }
.scorechip b { font-size: 12px; }
.epcount { top: 8px; left: 8px; height: 21px; padding: 0 7px; border-radius: 6px; font-size: 10px; }
.film-poster .mark { height: 20px; }
.film-poster .epcount { height: 20px; }

/* detail page */
.film-bg { filter: brightness(.38) saturate(1.06); transform: scale(1.02); }
.film-shade { background: linear-gradient(90deg, rgba(0, 0, 0, .82) 0%, rgba(0, 0, 0, .56) 42%, rgba(8, 8, 10, .24) 100%), linear-gradient(180deg, transparent 45%, rgba(8, 8, 10, .78)); }
.film h1 { font-size: 34px; line-height: 1.2; }
.film-poster img { border-radius: 14px; box-shadow: var(--shadow); }
.film .badge { border-color: rgba(231, 199, 180, .3); background: rgba(8, 8, 10, .25); }
.film-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.film-tools .btn, .film-tools .btn-ghost { height: 40px; padding: 0 14px; font-size: 13px; }
.film-tools .btn-ghost { border-color: rgba(231, 199, 180, .28); }
.film-tools .btn-ghost.on { color: #2a1612; background: linear-gradient(180deg, #f3d7c8, #e0b39a); }
.btn, .btn-ghost { transition: transform .18s ease, filter .18s ease, border-color .18s ease, background .18s ease; }
.btn:hover, .btn-ghost:hover { transform: translateY(-1px); filter: brightness(1.05); }

/* player */
.player-card { border-radius: 24px; border-color: rgba(231, 199, 180, .32); box-shadow: 0 32px 90px rgba(0, 0, 0, .62); }
.player-bar { min-height: 54px; }
.player-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .52);
  color: #fff;
  font-size: 14px;
}
.player-loading[hidden] { display: none; }
.player-loading .spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 10px;
  border: 2px solid rgba(255, 255, 255, .2);
  border-top-color: var(--gold-2);
  border-radius: 999px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.player-error { margin: 0; padding: 10px 14px; border-top: 1px solid rgba(225, 6, 0, .3); background: rgba(225, 6, 0, .1); color: #ffb4a8; font-size: 13px; text-align: center; }
.player-error[hidden] { display: none; }
.player-mask { overscroll-behavior: contain; }

/* vip / topup */
.tabvip.low small { color: #ffb4a8; }
.tabvip.expired small { color: #ff8a80; }
.viphall-hero h1 { letter-spacing: -.04em; }
.payway, .pack { border-color: rgba(231, 199, 180, .16); }
.payway.on, .pack:hover { border-color: rgba(231, 199, 180, .5); }
.pack.p30 { border-color: rgba(243, 215, 200, .5); }

/* footer */
.footbar { border-top-color: rgba(231, 199, 180, .18); background: radial-gradient(520px 140px at 0% 0%, rgba(225, 6, 0, .12), transparent 70%), radial-gradient(480px 160px at 100% 120%, rgba(231, 199, 180, .1), transparent 68%), #0a0a0c; }
.footbar nav a { color: #e9e4df; }
.footbar nav a:hover { color: var(--gold-2); }

/* empty / focus / motion */
.empty { color: var(--muted); }
.admin, .admin > *, .table-scroll { min-width: 0; }
.table-scroll { max-width: 100%; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* mobile */
@media (max-width: 899px) {
  .account-wrap.only-d { display: none; }
  .account-wrap .search-d { display: none; }
  .head.scrolled .top { height: 56px; }
  .head.scrolled .logo, .head.scrolled .logo img { height: 40px; }
  .hero-slider, .hero-slide { min-height: 480px; }
  .hero-slide h1 { font-size: 30px; max-width: 13ch; -webkit-line-clamp: 3; }
  .hero-dots { right: 16px; bottom: 14px; }
  .hero-dot { width: 20px; }
  .hero-dot.on { width: 36px; }
  .sec { margin: 24px 0 12px; }
  .sec b { font-size: 18px; }
  .rail-cards { grid-auto-columns: 138px; }
  .film h1 { font-size: 22px; }
  .film-tools { gap: 6px; }
  .film-tools .btn, .film-tools .btn-ghost { height: 38px; padding: 0 12px; font-size: 12px; }
  .search-overlay { padding-top: max(72px, env(safe-area-inset-top)); }
  .search-form input { height: 52px; font-size: 16px; }
  .search-form button { height: 52px; padding: 0 16px; }
  .toast { bottom: calc(82px + env(safe-area-inset-bottom)); font-size: 13px; }
}
