/* =========================================================
   บล็อกหน้าแรก + ธีมที่โครงหน้าต่างกัน (2026-11-16)
   <html data-layout="stream|grid|reels|magazine|mosaic"> มาจากธีม (layouts.js)
   บล็อกทุกชนิดใช้ได้ทุกธีม — ธีมแค่เปลี่ยนหน้าตาของบล็อกและโครงรวม
   ========================================================= */

/* ---------- บล็อกพื้นฐาน (ทุกธีม) ---------- */
.blk.bg-surface, .blk.bg-accent, .blk.bg-tint { margin: 0 var(--gutter) 30px; border-radius: var(--radius); padding: 18px 0 4px; }
.blk.bg-surface { background: var(--surface); }
.blk.bg-tint { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.blk.bg-accent { background: var(--accent); color: var(--on-accent); }
.blk.bg-accent .row-h a, .blk.bg-accent .card .s { color: inherit; opacity: .8; }
.blk[class*="bg-"] .row-h, .blk[class*="bg-"] .rail, .blk[class*="bg-"] .bgrid, .blk[class*="bg-"] .chips.wrap, .blk[class*="bg-"] .ptiles, .blk[class*="bg-"] .blk-text, .blk[class*="bg-"] .slist { padding-left: 18px; padding-right: 18px; }
.blk.pad-s > .row, .blk.pad-s > section { margin-bottom: 12px; }
.blk.pad-l { padding-top: 26px; padding-bottom: 26px; }

.bgrid { display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr)); gap: 22px var(--card-gap); padding: 8px var(--gutter) 6px; }
.slist { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; padding: 6px var(--gutter); }
.sitem { display: grid; grid-template-columns: 84px 1fr; gap: 14px; align-items: start; padding: 10px; border-radius: var(--radius); background: var(--surface); transition: background .2s; }
.sitem:hover { background: var(--surface2); }
.sitem img { width: 84px; aspect-ratio: 3/4; object-fit: cover; border-radius: var(--card-radius); }
.sitem .kicker { font-size: .74rem; margin-bottom: 4px; color: var(--muted); }
.sitem b { display: block; font-weight: 600; line-height: 1.35; }
.sitem p { margin: 4px 0 0; font-size: .82rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.feat { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 24px; padding: 6px var(--gutter); }
.feat-lead { position: relative; display: grid; grid-template-columns: minmax(150px, 42%) 1fr; gap: 22px; align-items: end; padding: 22px; border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.feat-lead img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: var(--card-radius); box-shadow: 0 18px 40px rgba(0,0,0,.45); }
.feat-cap h3 { margin: 6px 0 10px; font-size: clamp(1.4rem, 2.6vw, 2.3rem); line-height: 1.15; font-weight: var(--title-weight); }
.feat-cap p { margin: 0 0 18px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.feat-cap .kicker { color: var(--muted); font-size: .82rem; margin: 0; }
.feat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; counter-reset: f; }
.feat-list li { counter-increment: f; border-bottom: 1px solid var(--border); }
.feat-list a { display: grid; grid-template-columns: 2.2em 64px 1fr; gap: 12px; align-items: center; padding: 12px 0; }
.feat-list a::before { content: counter(f, decimal-leading-zero); font-size: 1.3rem; font-weight: 700; color: var(--accent); }
.feat-list img { width: 64px; aspect-ratio: 3/4; object-fit: cover; border-radius: var(--card-radius); }
.feat-list b { display: block; line-height: 1.3; font-weight: 600; }
.feat-list span { font-size: .78rem; color: var(--muted); }
.feat-list p { display: none; }

.mosaic { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: clamp(150px, 17vw, 250px); gap: 12px; padding: 6px var(--gutter); }
.mosaic .tile:first-child { grid-column: span 2; grid-row: span 2; }
.mosaic.n1 .tile:first-child { grid-column: 1 / -1; }
.mosaic.n2 .tile, .mosaic.n3 .tile:not(:first-child) { grid-column: span 2; }
.mosaic.n6 .tile:nth-child(6), .mosaic.n7 .tile:nth-child(n+6) { grid-column: span 2; }
.tile { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--surface); isolation: isolate; }
.tile-bg { position: absolute; inset: -30px; background: var(--img) center / cover; filter: blur(22px) brightness(.55) saturate(1.3); z-index: -1; }
.tile img { position: absolute; top: 0; bottom: 0; right: 0; height: 100%; width: auto; aspect-ratio: 3/4; object-fit: cover; transition: transform .45s; }
.tile:hover img { transform: scale(1.04); }
.tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.82) 0%, rgba(0,0,0,.35) 55%, transparent 80%); }
.tile-cap { position: absolute; z-index: 1; left: 0; bottom: 0; top: 0; width: 62%; display: flex; flex-direction: column; justify-content: flex-end; padding: 16px; color: #fff; }
.tile-cap .kicker { font-size: .72rem; margin-bottom: 6px; }
.tile-cap b { font-weight: 700; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile:first-child .tile-cap b { font-size: clamp(1.2rem, 2.2vw, 2rem); }
.tile-cap em { font-style: normal; font-size: .86rem; opacity: .85; margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.reels { position: relative; }
.reel-track { height: 100svh; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; overscroll-behavior-y: contain; }
.reel-track::-webkit-scrollbar { display: none; }
.reel { position: relative; height: 100svh; scroll-snap-align: start; scroll-snap-stop: always; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 4%; padding: calc(var(--header-h) + 20px) 8% 40px; overflow: hidden; isolation: isolate; }
.reel-bg { position: absolute; inset: -60px; background: var(--img) center / cover; filter: blur(40px) brightness(.4) saturate(1.4); z-index: -1; }
.reel-poster { justify-self: end; position: relative; height: min(78svh, 760px); aspect-ratio: 9/16; border-radius: 18px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.6); background: #000; }
.reel-poster img { width: 100%; height: 100%; object-fit: cover; }
.reel-play { position: absolute; inset: 0; margin: auto; width: 74px; height: 74px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.45); color: #fff; font-size: 1.7rem; backdrop-filter: blur(6px); transition: transform .2s, background .2s; }
.reel-poster:hover .reel-play { transform: scale(1.08); background: var(--accent); color: var(--on-accent); }
.reel-info { max-width: 520px; color: #fff; }
.reel-info h2 { margin: 6px 0 12px; font-size: clamp(1.6rem, 3.4vw, 3rem); line-height: 1.12; font-weight: var(--title-weight); }
.reel-info p { margin: 0 0 22px; opacity: .85; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.reel-n { position: absolute; right: 22px; top: calc(var(--header-h) + 16px); font-size: .8rem; opacity: .7; color: #fff; }
.reel-hint { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; font-size: .78rem; color: rgba(255,255,255,.7); pointer-events: none; animation: reel-hint 2.4s ease-in-out infinite; }
@keyframes reel-hint { 50% { transform: translateY(5px); opacity: .45; } }

.blk-text { padding: 0 var(--gutter); }
.blk-text h2 { margin: 0 0 8px; font-size: var(--row-title); font-weight: 600; }
.blk-text .txt { color: var(--muted); max-width: 72ch; }
.blk-text.center { text-align: center; }
.blk-text.center .txt { margin: 0 auto; }
.blk-banner { padding: 0 var(--gutter); }
.blk-banner img { width: 100%; height: auto; border-radius: var(--radius); }
.blk-spacer.s { height: 10px; } .blk-spacer.m { height: 30px; } .blk-spacer.l { height: 70px; }

@media (max-width: 960px) {
  .feat { grid-template-columns: 1fr; }
  .mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 44vw; }
  .mosaic .tile:first-child, .mosaic.n2 .tile, .mosaic.n3 .tile:not(:first-child) { grid-column: 1 / -1; grid-row: span 1; }
  .mosaic .tile:first-child { grid-row: span 2; }
  .mosaic.n6 .tile:nth-child(6), .mosaic.n7 .tile:nth-child(n+6) { grid-column: span 1; }
}
@media (orientation: portrait) and (max-width: 960px) {
  .bgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 8px; }
  [data-cards="landscape"] .bgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .slist { grid-template-columns: 1fr; }
  .feat-lead { grid-template-columns: 1fr; padding: 0; background: none; gap: 14px; }
  .feat-lead img { width: min(64vw, 320px); margin: 0 auto; }
  .reel-track, .reel { height: calc(100svh - 62px - env(safe-area-inset-bottom)); }
  .reel { grid-template-columns: 1fr; padding: 0; align-items: end; }
  .reel-poster { position: absolute; inset: 0; height: auto; width: 100%; aspect-ratio: auto; border-radius: 0; box-shadow: none; }
  .reel-poster::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0,0,0,.9) 0%, rgba(0,0,0,.2) 45%, rgba(0,0,0,.35) 100%); }
  .reel-play { z-index: 1; width: 62px; height: 62px; font-size: 1.4rem; }
  .reel-info { position: relative; z-index: 2; padding: 0 18px 48px; pointer-events: none; }
  .reel-info .actions { pointer-events: auto; }
  .reel-info h2 { font-size: 1.55rem; }
  .reel-info p { -webkit-line-clamp: 2; font-size: .9rem; margin-bottom: 14px; }
  .reel-n { z-index: 2; right: 14px; }
  .tile-cap { width: 100%; padding: 12px; }
  .tile img { width: 100%; }
  .tile::after { background: linear-gradient(0deg, rgba(0,0,0,.88) 0%, rgba(0,0,0,.1) 60%); }
  .tile:not(:first-child) .tile-cap .kicker { display: none; }
  .tile-cap b { font-size: .88rem; }
}

/* =========================================================
   8) สมุดภาพ (paper / layout grid) — พื้นสว่าง หมวดหมู่เป็นแถบข้างซ้าย ตารางปกแน่น
   ========================================================= */
[data-theme="paper"] {
  color-scheme: light;
  --bg: #f3f4f6; --bg2: #ffffff; --surface: #ffffff; --surface2: #e8ebf0; --text: #15171c; --muted: #5d6470;
  --accent: #1f4fd8; --accent2: #1a43b8; --on-accent: #fff; --border: rgba(21,23,28,.12);
  --font: 'Noto Sans Thai', system-ui, sans-serif;
  --radius: 10px; --card-radius: 6px; --btn-radius: 8px; --chip-radius: 8px;
  --header-bg: #fff; --header-solid: #fff;
  --btn-pri-bg: #1f4fd8; --btn-pri-fg: #fff; --btn-sec-bg: #e8ebf0; --btn-sec-fg: #15171c;
  --card-hover: translateY(-3px); --title-weight: 700; --row-title: 1.15rem;
  --shadow: 0 6px 18px rgba(21,23,28,.08);
}
[data-theme="paper"] #top { box-shadow: 0 1px 0 var(--border); }
[data-theme="paper"] body:not(.no-hero) #app { padding-top: var(--header-h); }
[data-theme="paper"] .logo-text { color: var(--text); font-weight: 800; letter-spacing: -.03em; }
[data-theme="paper"] .poster { box-shadow: 0 1px 2px rgba(21,23,28,.12), 0 6px 16px rgba(21,23,28,.08); }
[data-theme="paper"] .card .t { font-weight: 600; }
[data-theme="paper"] .kicker, [data-theme="paper"] .detail .desc { color: var(--muted); }
[data-theme="paper"] .badge.sub { background: #15171c; color: #fff; }
[data-theme="paper"] .badge.out { color: var(--text); }
[data-theme="paper"] .row-h { border-bottom: 2px solid var(--text); padding-bottom: 8px; margin: 0 var(--gutter) 12px; padding-left: 0; padding-right: 0; }
[data-theme="paper"] .row-h h2 { font-weight: 800; }
[data-theme="paper"] .rail-btn { background: rgba(255,255,255,.92); color: var(--text); box-shadow: var(--shadow); }
[data-theme="paper"] .ptile { background: #fff; color: var(--text); box-shadow: var(--shadow); }
[data-theme="paper"] .sitem, [data-theme="paper"] .feat-lead { box-shadow: var(--shadow); }
[data-theme="paper"] .detail-bg { filter: blur(50px) brightness(1.15) saturate(.8); opacity: .45; }
[data-theme="paper"] .detail-bg::after { background: linear-gradient(0deg, var(--bg) 10%, transparent 70%); }
[data-theme="paper"] .detail-poster { box-shadow: 0 18px 40px rgba(21,23,28,.25); border: 6px solid #fff; }
[data-theme="paper"] .side { background: #fff; }
[data-theme="paper"] .sk { background: linear-gradient(90deg, #e6e8ec 0%, #f1f3f6 50%, #e6e8ec 100%); background-size: 200% 100%; }
@media (min-width: 961px) {
  /* หมวดหมู่ (บล็อกแรก) = แถบข้างซ้ายติดจอ · บล็อกอื่นอยู่คอลัมน์ขวา */
  [data-layout="grid"] .rows:has(> .blk[data-bt="genres"]:first-child) { display: grid; grid-template-columns: 220px minmax(0, 1fr); column-gap: 28px; padding-left: var(--gutter); padding-top: 22px; }
  [data-layout="grid"] .rows:has(> .blk[data-bt="genres"]:first-child) > * { grid-column: 2; min-width: 0; }
  [data-layout="grid"] .rows:has(> .blk[data-bt="genres"]:first-child) > .blk[data-bt="genres"]:first-child { grid-column: 1; grid-row: 1 / span 60; }
  [data-layout="grid"] .rows:has(> .blk[data-bt="genres"]:first-child) > * > section, [data-layout="grid"] .rows:has(> .blk[data-bt="genres"]:first-child) .row-h { --gutter: 0px; }
  [data-layout="grid"] .rows > .blk[data-bt="genres"]:first-child .blk-genres { position: sticky; top: calc(var(--header-h) + 16px); }
  [data-layout="grid"] .rows > .blk[data-bt="genres"]:first-child .row-h { margin: 0 0 8px; }
  [data-layout="grid"] .rows > .blk[data-bt="genres"]:first-child .chips.wrap { flex-direction: column; gap: 2px; padding: 0; overflow: visible; }
  [data-layout="grid"] .rows > .blk[data-bt="genres"]:first-child .chip { justify-content: space-between; background: none; border: 0; border-radius: 6px; padding: 7px 10px; }
  [data-layout="grid"] .rows > .blk[data-bt="genres"]:first-child .chip:hover { background: var(--surface); color: var(--accent); }
}

/* =========================================================
   9) ฟีดแนวตั้ง (reel / layout reels) — เปิดมาเป็นฟีดเต็มจอเลื่อนลงทีละเรื่อง แบบแอปคลิปสั้น
   ========================================================= */
[data-theme="reel"] {
  --bg: #050507; --bg2: #0d0d12; --surface: #17171f; --surface2: #24242f; --muted: #9a9aab;
  --accent: #ff2e63; --accent2: #ff5c86; --on-accent: #fff;
  --font: 'Kanit', system-ui, sans-serif;
  --radius: 16px; --card-radius: 14px; --btn-radius: 999px;
  --header-bg: linear-gradient(180deg, rgba(0,0,0,.7), rgba(0,0,0,0));
  --header-solid: rgba(5,5,7,.96);
  --btn-pri-bg: #ff2e63; --btn-pri-fg: #fff; --btn-sec-bg: rgba(255,255,255,.16);
  --card-hover: scale(1.04); --title-weight: 700;
}
[data-theme="reel"] .logo-text { color: #fff; font-weight: 800; }
[data-theme="reel"] .logo-text::first-letter { color: var(--accent); }
[data-theme="reel"] .poster { aspect-ratio: 9/16; }
[data-theme="reel"] .row-h h2::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 10px; border-radius: 50%; background: var(--accent); vertical-align: middle; box-shadow: 0 0 12px var(--accent); }
[data-theme="reel"] .chip { background: rgba(255,255,255,.07); border-color: transparent; }
[data-theme="reel"] .ptile { background: linear-gradient(160deg, #2a0f1b, #0d0d12); }
[data-theme="reel"] .reels + .rows { padding-top: 22px; }
[data-theme="reel"] .detail-in { grid-template-columns: minmax(200px, 330px) 1fr; }
[data-theme="reel"] .detail-poster { aspect-ratio: 9/16; border-radius: 20px; }
[data-theme="reel"] .stage { background: radial-gradient(ellipse at center, #1a0a12 0%, #000 70%); }
[data-theme="reel"] .stage-inner { border-radius: 18px; overflow: hidden; }

/* =========================================================
   10) นิตยสาร (editorial / layout magazine) — หัวเรื่องตัวมีเชิง เรื่องเด่นพร้อมรายการลำดับ เส้นคั่นบางแบบหน้าหนังสือ
   ========================================================= */
[data-theme="editorial"] {
  --bg: #24101a; --bg2: #1c0c14; --surface: #321a26; --surface2: #432534; --text: #f6efe6; --muted: #c4b3a6;
  --accent: #e2b562; --accent2: #c99a45; --on-accent: #24101a; --border: rgba(246,239,230,.14);
  --font: 'Sarabun', system-ui, sans-serif; --serif: 'Noto Serif Thai', Georgia, serif;
  --radius: 2px; --card-radius: 2px; --btn-radius: 2px; --chip-radius: 2px;
  --header-bg: #24101a; --header-solid: #24101a;
  --btn-pri-bg: #e2b562; --btn-pri-fg: #24101a; --btn-sec-bg: transparent; --btn-sec-fg: #f6efe6;
  --card-hover: translateY(-2px); --title-weight: 700; --row-title: 1.6rem;
}
[data-theme="editorial"] #top { border-bottom: 1px solid var(--border); }
[data-theme="editorial"] body:not(.no-hero) #app { padding-top: var(--header-h); }
[data-theme="editorial"] .logo-text { font-family: var(--serif); color: var(--text); font-weight: 800; letter-spacing: -.01em; }
[data-theme="editorial"] h1, [data-theme="editorial"] h2, [data-theme="editorial"] h3, [data-theme="editorial"] .feat-list b, [data-theme="editorial"] .sitem b, [data-theme="editorial"] .card .t { font-family: var(--serif); }
[data-theme="editorial"] .btn.sec { border: 1px solid var(--border); backdrop-filter: none; }
[data-theme="editorial"] .row-h { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; margin-bottom: 14px; }
[data-theme="editorial"] .row-h::after { content: ""; grid-column: 2; grid-row: 1; height: 1px; background: var(--border); }
[data-theme="editorial"] .row-h a { grid-column: 3; color: var(--accent); }
[data-theme="editorial"] .row-h h2 { font-weight: 700; }
[data-theme="editorial"] .poster { box-shadow: none; outline: 1px solid var(--border); outline-offset: 4px; }
[data-theme="editorial"] .rail { gap: 18px; padding-top: 12px; }
[data-theme="editorial"] .card .t { font-weight: 600; font-size: .95rem; }
[data-theme="editorial"] .feat-lead { background: none; padding: 0 28px 0 0; border-right: 1px solid var(--border); border-radius: 0; }
[data-theme="editorial"] .feat-cap h3 { font-size: clamp(1.8rem, 3.4vw, 3.2rem); }
[data-theme="editorial"] .feat-list a::before { font-family: var(--serif); font-style: italic; font-size: 1.6rem; }
[data-theme="editorial"] .sitem { background: none; border-top: 1px solid var(--border); border-radius: 0; padding: 14px 0; }
[data-theme="editorial"] .slist { column-gap: 28px; row-gap: 0; }
[data-theme="editorial"] .chip { background: none; border-color: var(--border); }
[data-theme="editorial"] .chip small { color: var(--accent); opacity: 1; }
[data-theme="editorial"] .ptile { background: var(--surface); border: 1px solid var(--border); }
[data-theme="editorial"] .detail-bg { display: none; }
[data-theme="editorial"] .detail-in { grid-template-columns: 1fr minmax(220px, 340px); align-items: center; padding-top: calc(var(--header-h) + 50px); border-bottom: 1px solid var(--border); }
[data-theme="editorial"] .detail-in > .detail-poster { order: 2; }
[data-theme="editorial"] .detail h1 { font-size: clamp(2rem, 4.6vw, 3.8rem); }
[data-theme="editorial"] .detail .desc { font-size: 1.06rem; line-height: 1.8; color: var(--muted); }
[data-theme="editorial"] .side { background: var(--bg2); }
[data-theme="editorial"] .side h1 { font-size: 1.6rem; }
@media (orientation: portrait) and (max-width: 960px) {
  [data-theme="editorial"] .detail-in { grid-template-columns: 1fr; }
  [data-theme="editorial"] .detail-in > .detail-poster { order: 0; }
  [data-theme="editorial"] .feat-lead { border: 0; padding: 0; }
  [data-theme="editorial"] { --row-title: 1.3rem; }
}

/* =========================================================
   11) ป๊อป (pop / layout mosaic) — กระเบื้องเรื่องเด่นหลายขนาด สีสด ขอบหนาเงาแข็ง
   ========================================================= */
[data-theme="pop"] {
  --bg: #1b1464; --bg2: #160f52; --surface: #2a2380; --surface2: #3a3299; --muted: #c9c5f2;
  --accent: #ff7a59; --accent2: #ffb238; --on-accent: #1b1464; --border: rgba(255,255,255,.18);
  --font: 'Mitr', system-ui, sans-serif;
  --radius: 22px; --card-radius: 16px; --btn-radius: 14px; --chip-radius: 999px;
  --header-bg: #1b1464; --header-solid: #1b1464;
  --btn-pri-bg: #ffb238; --btn-pri-fg: #1b1464; --btn-sec-bg: #fff; --btn-sec-fg: #1b1464;
  --card-hover: translate(-3px, -3px); --title-weight: 600;
  --pop-shadow: 5px 5px 0 #0c0838;
}
[data-theme="pop"] body:not(.no-hero) #app { padding-top: var(--header-h); }
[data-theme="pop"] .blk-mosaic { padding-top: 16px; }
[data-theme="pop"] .logo-text { color: #ffb238; font-weight: 700; }
[data-theme="pop"] .btn { box-shadow: var(--pop-shadow); border: 2px solid #0c0838; }
[data-theme="pop"] .btn:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 #0c0838; }
[data-theme="pop"] .poster, [data-theme="pop"] .tile, [data-theme="pop"] .ptile, [data-theme="pop"] .sitem, [data-theme="pop"] .feat-lead { border: 2px solid #0c0838; box-shadow: var(--pop-shadow); }
[data-theme="pop"] .card:hover .poster { box-shadow: 8px 8px 0 #ff7a59; }
[data-theme="pop"] .tile:nth-child(3n+2) .tile-bg { filter: blur(22px) brightness(.5) hue-rotate(40deg); }
[data-theme="pop"] .row-h h2 { display: inline-block; background: #ff7a59; color: #1b1464; padding: 2px 14px; border-radius: 999px; transform: rotate(-1.5deg); font-weight: 600; }
[data-theme="pop"] .chip { background: #fff; color: #1b1464; border: 2px solid #0c0838; font-weight: 500; }
[data-theme="pop"] .chip:nth-child(4n+2) { background: #ffb238; }
[data-theme="pop"] .chip:nth-child(4n+3) { background: #ff7a59; }
[data-theme="pop"] .chip:nth-child(4n) { background: #7ee0c3; }
[data-theme="pop"] .chip small { color: #1b1464; opacity: .7; }
[data-theme="pop"] .ptile { background: #2a2380; }
[data-theme="pop"] .detail-bg { filter: blur(40px) brightness(.5) saturate(1.6) hue-rotate(-20deg); }
[data-theme="pop"] .detail-poster { border: 3px solid #0c0838; box-shadow: 10px 10px 0 #ff7a59; border-radius: 22px; }
[data-theme="pop"] .stage-inner { border: 3px solid #0c0838; border-radius: 20px; overflow: hidden; box-shadow: 8px 8px 0 #ff7a59; }
[data-theme="pop"] .stage { background: #120d47; }
[data-theme="pop"] .side { background: var(--bg2); }
@media (orientation: portrait) and (max-width: 960px) {
  [data-theme="pop"] { --pop-shadow: 3px 3px 0 #0c0838; }
  [data-theme="pop"] .stage-inner { border: 0; border-radius: 0; box-shadow: none; }
}

/* แก้หลังดูภาพจริง */
body.no-hero #app > .rows { padding-top: 22px; }
[data-theme="paper"] .search { background: #eef0f4; }
[data-theme="paper"] .search input { color: var(--text); }
[data-theme="paper"] .card.rank .num { -webkit-text-stroke: 3px rgba(21,23,28,.55); }
[data-theme="paper"] .dd-menu, [data-theme="paper"] #drawer { background: #fff; color: var(--text); }
[data-theme="paper"] #bottom-nav { background: rgba(255,255,255,.97); border-top: 1px solid var(--border); }

/* =========================================================
   ธีมชุดที่ 2 (2026-11-16, เจ้าของสั่ง "เพิ่มอีก 10–20 ธีม") — 15 ธีม ชื่อกลาง ๆ ไม่ใช้ชื่อแบรนด์
   โครงหน้า: stream = jade ember ocean gold neon mono · grid = mint sakura slate · reels = night sunset
            magazine = ink lotus · mosaic = candy comic  (ต้องตรงกับ layouts.js / app.js / admin.js / og.js)
   ========================================================= */

/* ---- ส่วนกลางของชุดที่ 2 ---- */
:is([data-layout="grid"], [data-layout="magazine"], [data-layout="mosaic"]) body:not(.no-hero) #app { padding-top: var(--header-h); }
:is([data-theme="night"], [data-theme="sunset"]) .poster { aspect-ratio: 9/16; }
:is([data-theme="night"], [data-theme="sunset"]) .reels + .rows { padding-top: 22px; }
:is([data-theme="night"], [data-theme="sunset"]) .detail-in { grid-template-columns: minmax(200px, 330px) 1fr; }
:is([data-theme="night"], [data-theme="sunset"]) .detail-poster { aspect-ratio: 9/16; border-radius: 20px; }
:is([data-theme="night"], [data-theme="sunset"]) .stage-inner { border-radius: 18px; overflow: hidden; }
:is([data-theme="night"], [data-theme="sunset"]) .logo-text { color: #fff; font-weight: 800; }
:is([data-theme="night"], [data-theme="sunset"]) .logo-text::first-letter { color: var(--accent); }

/* ธีมพื้นสว่าง (แก้ส่วนที่ app.css เขียนไว้สำหรับพื้นมืด — แบบเดียวกับ paper) */
:is([data-theme="mint"], [data-theme="sakura"], [data-theme="ink"], [data-theme="candy"]) { color-scheme: light; }
:is([data-theme="mint"], [data-theme="sakura"], [data-theme="ink"], [data-theme="candy"]) #top { box-shadow: 0 1px 0 var(--border); }
:is([data-theme="mint"], [data-theme="sakura"], [data-theme="ink"], [data-theme="candy"]) .search { background: var(--surface2); }
:is([data-theme="mint"], [data-theme="sakura"], [data-theme="ink"], [data-theme="candy"]) .search input { color: var(--text); }
:is([data-theme="mint"], [data-theme="sakura"], [data-theme="ink"], [data-theme="candy"]) :is(.dd-menu, #drawer) { background: var(--bg2); color: var(--text); }
:is([data-theme="mint"], [data-theme="sakura"], [data-theme="ink"], [data-theme="candy"]) #bottom-nav { background: color-mix(in srgb, var(--bg2) 96%, transparent); border-top: 1px solid var(--border); }
:is([data-theme="mint"], [data-theme="sakura"], [data-theme="ink"], [data-theme="candy"]) .sk { background: linear-gradient(90deg, var(--surface2) 0%, var(--bg2) 50%, var(--surface2) 100%); background-size: 200% 100%; }
:is([data-theme="mint"], [data-theme="sakura"], [data-theme="ink"], [data-theme="candy"]) .rail-btn { background: color-mix(in srgb, var(--bg2) 92%, transparent); color: var(--text); box-shadow: var(--shadow); }
:is([data-theme="mint"], [data-theme="sakura"], [data-theme="ink"], [data-theme="candy"]) .ptile { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
:is([data-theme="mint"], [data-theme="sakura"], [data-theme="ink"], [data-theme="candy"]) .badge.sub { background: var(--text); color: var(--bg2); }
:is([data-theme="mint"], [data-theme="sakura"], [data-theme="ink"], [data-theme="candy"]) .badge.out { color: var(--text); }
:is([data-theme="mint"], [data-theme="sakura"], [data-theme="ink"], [data-theme="candy"]) .card.rank .num { -webkit-text-stroke: 3px color-mix(in srgb, var(--text) 55%, transparent); }
:is([data-theme="mint"], [data-theme="sakura"], [data-theme="ink"], [data-theme="candy"]) :is(.kicker, .detail .desc) { color: var(--muted); }
:is([data-theme="mint"], [data-theme="sakura"], [data-theme="candy"]) .detail-bg { filter: blur(50px) brightness(1.15) saturate(.8); opacity: .45; }
:is([data-theme="mint"], [data-theme="sakura"], [data-theme="candy"]) .detail-bg::after { background: linear-gradient(0deg, var(--bg) 10%, transparent 70%); }
:is([data-theme="mint"], [data-theme="sakura"]) .detail-poster { box-shadow: 0 18px 40px rgba(0,0,0,.18); border: 6px solid var(--bg2); }
:is([data-theme="mint"], [data-theme="sakura"], [data-theme="ink"], [data-theme="candy"]) .side { background: var(--bg2); }

/* โครงนิตยสาร (ink, lotus — แบบ editorial) */
:is([data-theme="ink"], [data-theme="lotus"]) #top { border-bottom: 1px solid var(--border); }
:is([data-theme="ink"], [data-theme="lotus"]) .logo-text { font-family: var(--serif); color: var(--text); font-weight: 800; }
:is([data-theme="ink"], [data-theme="lotus"]) :is(h1, h2, h3, .feat-list b, .sitem b, .card .t) { font-family: var(--serif); }
:is([data-theme="ink"], [data-theme="lotus"]) .btn.sec { border: 1px solid var(--border); backdrop-filter: none; }
:is([data-theme="ink"], [data-theme="lotus"]) .row-h { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; margin-bottom: 14px; }
:is([data-theme="ink"], [data-theme="lotus"]) .row-h::after { content: ""; grid-column: 2; grid-row: 1; height: 1px; background: var(--border); }
:is([data-theme="ink"], [data-theme="lotus"]) .row-h a { grid-column: 3; color: var(--accent); }
:is([data-theme="ink"], [data-theme="lotus"]) .poster { box-shadow: none; outline: 1px solid var(--border); outline-offset: 4px; }
:is([data-theme="ink"], [data-theme="lotus"]) .rail { gap: 18px; padding-top: 12px; }
:is([data-theme="ink"], [data-theme="lotus"]) .feat-lead { background: none; padding: 0 28px 0 0; border-right: 1px solid var(--border); border-radius: 0; }
:is([data-theme="ink"], [data-theme="lotus"]) .feat-cap h3 { font-size: clamp(1.8rem, 3.4vw, 3.2rem); }
:is([data-theme="ink"], [data-theme="lotus"]) .feat-list a::before { font-family: var(--serif); font-style: italic; font-size: 1.6rem; }
:is([data-theme="ink"], [data-theme="lotus"]) .sitem { background: none; border-top: 1px solid var(--border); border-radius: 0; padding: 14px 0; }
:is([data-theme="ink"], [data-theme="lotus"]) .slist { column-gap: 28px; row-gap: 0; }
:is([data-theme="ink"], [data-theme="lotus"]) .chip { background: none; border-color: var(--border); }
:is([data-theme="ink"], [data-theme="lotus"]) .chip small { color: var(--accent); opacity: 1; }
:is([data-theme="ink"], [data-theme="lotus"]) .detail-bg { display: none; }
:is([data-theme="ink"], [data-theme="lotus"]) .detail-in { grid-template-columns: 1fr minmax(220px, 340px); align-items: center; padding-top: calc(var(--header-h) + 50px); border-bottom: 1px solid var(--border); }
:is([data-theme="ink"], [data-theme="lotus"]) .detail-in > .detail-poster { order: 2; }
:is([data-theme="ink"], [data-theme="lotus"]) .detail h1 { font-size: clamp(2rem, 4.6vw, 3.8rem); }
:is([data-theme="ink"], [data-theme="lotus"]) .detail .desc { font-size: 1.06rem; line-height: 1.8; color: var(--muted); }
@media (orientation: portrait) and (max-width: 960px) {
  :is([data-theme="ink"], [data-theme="lotus"]) .detail-in { grid-template-columns: 1fr; }
  :is([data-theme="ink"], [data-theme="lotus"]) .detail-in > .detail-poster { order: 0; }
  :is([data-theme="ink"], [data-theme="lotus"]) .feat-lead { border: 0; padding: 0; }
  :is([data-theme="ink"], [data-theme="lotus"]) { --row-title: 1.3rem; }
}

/* โครงกระเบื้อง (candy, comic — แบบ pop · สีขอบ = --pop-ink) */
:is([data-theme="candy"], [data-theme="comic"]) .blk-mosaic { padding-top: 16px; }
:is([data-theme="candy"], [data-theme="comic"]) .btn { box-shadow: var(--pop-shadow); border: 2px solid var(--pop-ink); }
:is([data-theme="candy"], [data-theme="comic"]) .btn:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--pop-ink); }
:is([data-theme="candy"], [data-theme="comic"]) :is(.poster, .tile, .ptile, .sitem, .feat-lead) { border: 2px solid var(--pop-ink); box-shadow: var(--pop-shadow); }
:is([data-theme="candy"], [data-theme="comic"]) .card:hover .poster { box-shadow: 8px 8px 0 var(--accent); }
:is([data-theme="candy"], [data-theme="comic"]) .row-h h2 { display: inline-block; background: var(--accent); color: var(--on-accent); padding: 2px 14px; border-radius: 999px; transform: rotate(-1.5deg); font-weight: 600; }
:is([data-theme="candy"], [data-theme="comic"]) .chip { background: var(--bg2); color: var(--text); border: 2px solid var(--pop-ink); font-weight: 500; }
:is([data-theme="candy"], [data-theme="comic"]) .chip:nth-child(3n+2) { background: var(--accent2); color: var(--pop-ink); }
:is([data-theme="candy"], [data-theme="comic"]) .chip:nth-child(3n) { background: var(--accent); color: var(--on-accent); }
:is([data-theme="candy"], [data-theme="comic"]) .chip small { color: inherit; opacity: .7; }
:is([data-theme="candy"], [data-theme="comic"]) .detail-poster { border: 3px solid var(--pop-ink); box-shadow: 10px 10px 0 var(--accent); border-radius: 22px; }
:is([data-theme="candy"], [data-theme="comic"]) .stage-inner { border: 3px solid var(--pop-ink); border-radius: 20px; overflow: hidden; box-shadow: 8px 8px 0 var(--accent); }
:is([data-theme="candy"], [data-theme="comic"]) .side { background: var(--bg2); }
@media (orientation: portrait) and (max-width: 960px) {
  :is([data-theme="candy"], [data-theme="comic"]) { --pop-shadow: 3px 3px 0 var(--pop-ink); }
  :is([data-theme="candy"], [data-theme="comic"]) .stage-inner { border: 0; border-radius: 0; box-shadow: none; }
}

/* ---- 12) หยก — เขียวหยกเข้ม ปุ่มมน ---- */
[data-theme="jade"] {
  --bg: #0b1a16; --bg2: #0f211c; --surface: #16302a; --surface2: #1f3f37; --muted: #9fbab0;
  --accent: #2fd3a0; --accent2: #22b386; --on-accent: #04130e; --border: rgba(159,186,176,.16);
  --font: 'Prompt', system-ui, sans-serif;
  --radius: 12px; --card-radius: 10px; --btn-radius: 999px;
  --header-solid: rgba(11,26,22,.97);
  --btn-pri-bg: #2fd3a0; --btn-pri-fg: #04130e; --btn-sec-bg: rgba(255,255,255,.12);
  --card-hover: translateY(-4px);
}
[data-theme="jade"] .slide::after { background: linear-gradient(90deg, rgba(11,26,22,.92) 0%, rgba(11,26,22,.4) 50%, transparent 75%), linear-gradient(0deg, var(--bg) 0%, transparent 35%); }
[data-theme="jade"] .row-h h2::after { content: ""; display: block; width: 34px; height: 3px; margin-top: 6px; border-radius: 3px; background: var(--accent); }
[data-theme="jade"] .card:hover .poster { box-shadow: 0 0 0 2px var(--accent), 0 14px 30px rgba(0,0,0,.5); }
[data-theme="jade"] .ptile { background: linear-gradient(135deg, #1f4a3f, #0b1a16); }
[data-theme="jade"] .logo-text { color: #e6fff6; font-weight: 700; }

/* ---- 13) ถ่านไฟ — ดำอมน้ำตาล ส้มไฟ ---- */
[data-theme="ember"] {
  --bg: #140a07; --bg2: #1b0e0a; --surface: #2a1712; --surface2: #3a2018; --muted: #c3a597;
  --accent: #ff6a2b; --accent2: #ff9152; --on-accent: #1a0a05; --border: rgba(255,145,82,.16);
  --font: 'Kanit', system-ui, sans-serif;
  --radius: 6px; --card-radius: 6px; --btn-radius: 6px;
  --header-solid: rgba(20,10,7,.97);
  --btn-pri-bg: #ff6a2b; --btn-pri-fg: #1a0a05;
}
[data-theme="ember"] .slide::after { background: linear-gradient(90deg, rgba(20,10,7,.92) 0%, rgba(60,20,8,.45) 50%, transparent 78%), linear-gradient(0deg, var(--bg) 0%, transparent 35%); }
[data-theme="ember"] .logo-text { background: linear-gradient(90deg, #ffd0a8, #ff6a2b); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }
[data-theme="ember"] .card:hover .poster { box-shadow: 0 14px 34px rgba(255,106,43,.35); }
[data-theme="ember"] .row-h h2 { font-weight: 600; }
[data-theme="ember"] .ptile { background: linear-gradient(135deg, #4a2416, #140a07); }

/* ---- 14) ทะเลลึก — น้ำเงินลึก ฟ้าใส หัวเว็บใสเบลอ ---- */
[data-theme="ocean"] {
  --bg: #06141f; --bg2: #0a1b29; --surface: #102737; --surface2: #183548; --muted: #8fb1c6;
  --accent: #29c4ff; --accent2: #1aa6dd; --on-accent: #04121c; --border: rgba(143,177,198,.16);
  --font: 'Noto Sans Thai', system-ui, sans-serif;
  --radius: 14px; --card-radius: 10px; --btn-radius: 10px;
  --header-solid: rgba(6,20,31,.82);
  --btn-pri-bg: #29c4ff; --btn-pri-fg: #04121c; --btn-sec-bg: rgba(255,255,255,.12);
}
[data-theme="ocean"] #top.solid, [data-theme="ocean"] body.no-hero #top { backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
[data-theme="ocean"] .slide::after { background: linear-gradient(90deg, rgba(6,20,31,.9) 0%, rgba(6,20,31,.35) 55%, transparent 78%), linear-gradient(0deg, var(--bg) 0%, transparent 40%); }
[data-theme="ocean"] .row-h h2::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 10px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
[data-theme="ocean"] .card:hover .poster { box-shadow: 0 0 0 2px var(--accent), 0 18px 36px rgba(0,0,0,.55); }
[data-theme="ocean"] .ptile { background: linear-gradient(160deg, #15405a, #06141f); }
[data-theme="ocean"] .logo-text { color: #e8f7ff; font-weight: 700; letter-spacing: -.02em; }

/* ---- 15) ทองคำ — ดำทอง ตัวมีเชิง เส้นทองบาง ---- */
[data-theme="gold"] {
  --bg: #0d0b07; --bg2: #13100a; --surface: #1f1a11; --surface2: #2b2418; --text: #f5eedd; --muted: #b8ab8f;
  --accent: #d4a64a; --accent2: #e9c46a; --on-accent: #1a1408; --border: rgba(212,166,74,.2);
  --font: 'Sarabun', system-ui, sans-serif; --serif: 'Noto Serif Thai', Georgia, serif;
  --radius: 3px; --card-radius: 3px; --btn-radius: 3px;
  --header-solid: rgba(13,11,7,.97);
  --btn-pri-bg: #d4a64a; --btn-pri-fg: #1a1408; --btn-sec-bg: transparent; --btn-sec-fg: #f5eedd;
  --card-hover: translateY(-3px);
}
[data-theme="gold"] :is(.logo-text, h1, h2, h3, .card .t) { font-family: var(--serif); }
[data-theme="gold"] .logo-text { color: var(--accent2); font-weight: 700; }
[data-theme="gold"] .btn.sec { border: 1px solid var(--accent); }
[data-theme="gold"] .poster { outline: 1px solid var(--border); outline-offset: 3px; }
[data-theme="gold"] .card:hover .poster { outline-color: var(--accent); }
[data-theme="gold"] .row-h h2 { font-weight: 700; }
[data-theme="gold"] .ptile { background: linear-gradient(135deg, #2b2418, #0d0b07); border: 1px solid var(--border); }

/* ---- 16) นีออน — ม่วงดำ ชมพูเรืองแสง ---- */
[data-theme="neon"] {
  --bg: #09061a; --bg2: #0e0a24; --surface: #181238; --surface2: #241b4d; --muted: #a9a2d6;
  --accent: #ff2bd6; --accent2: #22d3ee; --on-accent: #fff; --border: rgba(169,162,214,.18);
  --font: 'Chakra Petch', system-ui, sans-serif;
  --radius: 8px; --card-radius: 8px; --btn-radius: 8px;
  --header-solid: rgba(9,6,26,.96);
  --btn-pri-bg: #ff2bd6; --btn-pri-fg: #fff; --btn-sec-bg: rgba(34,211,238,.16); --btn-sec-fg: #e6fbff;
}
[data-theme="neon"] .logo-text { color: #fff; font-weight: 700; text-shadow: 0 0 10px rgba(255,43,214,.8), 0 0 24px rgba(255,43,214,.45); }
[data-theme="neon"] .row-h h2 { background: linear-gradient(90deg, #ff2bd6, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 700; }
[data-theme="neon"] .card:hover .poster { box-shadow: 0 0 0 2px #22d3ee, 0 0 26px rgba(34,211,238,.55); }
[data-theme="neon"] .ptile { background: linear-gradient(135deg, #3a1260, #09061a); }

/* ---- 17) ขาวดำ — ขาวดำล้วน ขอบเหลี่ยม ปกเป็นสีเมื่อชี้ ---- */
[data-theme="mono"] {
  --bg: #0a0a0a; --bg2: #111111; --surface: #1c1c1c; --surface2: #2a2a2a; --muted: #9a9a9a;
  --accent: #ffffff; --accent2: #d4d4d4; --on-accent: #0a0a0a; --border: rgba(255,255,255,.16);
  --font: 'Anuphan', system-ui, sans-serif;
  --radius: 0px; --card-radius: 0px; --btn-radius: 0px; --chip-radius: 0px;
  --header-solid: #0a0a0a;
  --btn-pri-bg: #fff; --btn-pri-fg: #0a0a0a; --btn-sec-bg: transparent; --btn-sec-fg: #fff;
  --card-hover: none;
}
[data-theme="mono"] .poster img { filter: grayscale(.85) contrast(1.05); transition: filter .35s; }
[data-theme="mono"] .card:hover .poster img { filter: none; }
[data-theme="mono"] .btn.sec { border: 1px solid #fff; }
[data-theme="mono"] .row-h h2 { font-weight: 600; letter-spacing: .02em; }
[data-theme="mono"] .logo-text { font-weight: 800; letter-spacing: -.03em; }
[data-theme="mono"] .ptile { background: #161616; border: 1px solid var(--border); }

/* ---- 18) มินต์ (grid, สว่าง) ---- */
[data-theme="mint"] {
  --bg: #eef7f3; --bg2: #ffffff; --surface: #ffffff; --surface2: #dcebe4; --text: #10241d; --muted: #557066;
  --accent: #0e9f74; --accent2: #0b8562; --on-accent: #fff; --border: rgba(16,36,29,.12);
  --font: 'Anuphan', system-ui, sans-serif;
  --radius: 12px; --card-radius: 8px; --btn-radius: 999px; --chip-radius: 999px;
  --header-bg: #fff; --header-solid: #fff;
  --btn-pri-bg: #0e9f74; --btn-pri-fg: #fff; --btn-sec-bg: #dcebe4; --btn-sec-fg: #10241d;
  --card-hover: translateY(-3px); --row-title: 1.15rem;
  --shadow: 0 6px 18px rgba(16,36,29,.08);
}
[data-theme="mint"] .logo-text { color: var(--accent2); font-weight: 800; }
[data-theme="mint"] .poster { box-shadow: 0 1px 2px rgba(16,36,29,.12), 0 6px 16px rgba(16,36,29,.08); }
[data-theme="mint"] .row-h h2 { font-weight: 700; }
[data-theme="mint"] .row-h h2::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 3px; background: var(--accent); }

/* ---- 19) ซากุระ (grid, สว่าง ชมพู โค้งมน) ---- */
[data-theme="sakura"] {
  --bg: #fdf2f5; --bg2: #ffffff; --surface: #ffffff; --surface2: #f6dde5; --text: #3a1a26; --muted: #8a5d6d;
  --accent: #d9467a; --accent2: #bf3567; --on-accent: #fff; --border: rgba(58,26,38,.12);
  --font: 'Mitr', system-ui, sans-serif;
  --radius: 18px; --card-radius: 14px; --btn-radius: 999px; --chip-radius: 999px;
  --header-bg: #fff; --header-solid: #fff;
  --btn-pri-bg: #d9467a; --btn-pri-fg: #fff; --btn-sec-bg: #f6dde5; --btn-sec-fg: #3a1a26;
  --card-hover: translateY(-4px); --title-weight: 600; --row-title: 1.15rem;
  --shadow: 0 8px 22px rgba(217,70,122,.12);
}
[data-theme="sakura"] .logo-text { color: var(--accent); font-weight: 600; }
[data-theme="sakura"] .poster { box-shadow: 0 8px 20px rgba(217,70,122,.14); }
[data-theme="sakura"] .card:hover .poster { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--accent); }
[data-theme="sakura"] .row-h h2 { font-weight: 500; }

/* ---- 20) กระดานชนวน (grid, มืด) ---- */
[data-theme="slate"] {
  --bg: #14171d; --bg2: #191d24; --surface: #20252e; --surface2: #2b313c; --muted: #98a1b0;
  --accent: #7aa2ff; --accent2: #5b86f0; --on-accent: #0b1020; --border: rgba(152,161,176,.16);
  --font: 'IBM Plex Sans Thai', system-ui, sans-serif;
  --radius: 8px; --card-radius: 6px; --btn-radius: 6px; --chip-radius: 6px;
  --header-bg: #14171d; --header-solid: #14171d;
  --btn-pri-bg: #7aa2ff; --btn-pri-fg: #0b1020; --btn-sec-bg: #2b313c;
  --card-hover: translateY(-3px); --row-title: 1.1rem;
}
[data-theme="slate"] .row-h { border-bottom: 1px solid var(--border); padding-bottom: 8px; margin: 0 var(--gutter) 12px; padding-left: 0; padding-right: 0; }
[data-theme="slate"] .row-h h2 { font-weight: 600; }
[data-theme="slate"] .logo-text { color: #e7ecf5; font-weight: 700; }
[data-theme="slate"] .ptile { background: var(--surface); border: 1px solid var(--border); }

/* ---- 21) ราตรี (reels) ---- */
[data-theme="night"] {
  --bg: #07060f; --bg2: #0d0b1a; --surface: #16142a; --surface2: #221f3d; --muted: #a29fc4;
  --accent: #8b7bff; --accent2: #a99dff; --on-accent: #fff;
  --font: 'Prompt', system-ui, sans-serif;
  --radius: 16px; --card-radius: 14px; --btn-radius: 999px;
  --header-bg: linear-gradient(180deg, rgba(0,0,0,.7), rgba(0,0,0,0)); --header-solid: rgba(7,6,15,.96);
  --btn-pri-bg: #8b7bff; --btn-pri-fg: #fff; --btn-sec-bg: rgba(255,255,255,.16);
  --card-hover: scale(1.04);
}
[data-theme="night"] .stage { background: radial-gradient(ellipse at center, #15112e 0%, #000 70%); }
[data-theme="night"] .ptile { background: linear-gradient(160deg, #241d52, #0d0b1a); }

/* ---- 22) พระอาทิตย์ตก (reels) ---- */
[data-theme="sunset"] {
  --bg: #120707; --bg2: #1a0b0a; --surface: #2a1210; --surface2: #3b1b16; --muted: #d1a99a;
  --accent: #ff8a3d; --accent2: #ffd166; --on-accent: #1a0a03;
  --font: 'Mitr', system-ui, sans-serif;
  --radius: 16px; --card-radius: 14px; --btn-radius: 999px;
  --header-bg: linear-gradient(180deg, rgba(0,0,0,.7), rgba(0,0,0,0)); --header-solid: rgba(18,7,7,.96);
  --btn-pri-bg: #ff8a3d; --btn-pri-fg: #1a0a03; --btn-sec-bg: rgba(255,255,255,.16);
  --card-hover: scale(1.04); --title-weight: 600;
}
[data-theme="sunset"] .stage { background: radial-gradient(ellipse at center, #2e1009 0%, #000 70%); }
[data-theme="sunset"] .ptile { background: linear-gradient(160deg, #5a1f12, #1a0b0a); }
[data-theme="sunset"] .reel-bg { filter: blur(40px) brightness(.45) saturate(1.6) sepia(.25); }

/* ---- 23) หมึกจีน (magazine, สว่าง กระดาษข้าว ตราแดง) ---- */
[data-theme="ink"] {
  --bg: #f4efe4; --bg2: #ebe4d4; --surface: #fbf8f1; --surface2: #e6dcc7; --text: #1d1a16; --muted: #6b6255;
  --accent: #b3261e; --accent2: #8f1d17; --on-accent: #fff; --border: rgba(29,26,22,.16);
  --font: 'Sarabun', system-ui, sans-serif; --serif: 'Noto Serif Thai', Georgia, serif;
  --radius: 2px; --card-radius: 2px; --btn-radius: 2px; --chip-radius: 2px;
  --header-bg: #f4efe4; --header-solid: #f4efe4;
  --btn-pri-bg: #b3261e; --btn-pri-fg: #fff; --btn-sec-bg: transparent; --btn-sec-fg: #1d1a16;
  --card-hover: translateY(-2px); --row-title: 1.6rem;
  --shadow: 0 6px 18px rgba(29,26,22,.1);
}
[data-theme="ink"] .logo-text::before { content: ""; display: inline-block; width: .9em; height: .9em; margin-right: .35em; background: var(--accent); border-radius: 2px; vertical-align: -.1em; }

/* ---- 24) บัวหลวง (magazine, มืด น้ำเงินคราม ชมพูบัว) ---- */
[data-theme="lotus"] {
  --bg: #0e1324; --bg2: #0b0f1d; --surface: #182038; --surface2: #222c4a; --text: #eef0f8; --muted: #a6aecb;
  --accent: #f2a7c3; --accent2: #e98bb0; --on-accent: #1a1030; --border: rgba(238,240,248,.14);
  --font: 'Sarabun', system-ui, sans-serif; --serif: 'Noto Serif Thai', Georgia, serif;
  --radius: 4px; --card-radius: 4px; --btn-radius: 999px; --chip-radius: 999px;
  --header-bg: #0e1324; --header-solid: #0e1324;
  --btn-pri-bg: #f2a7c3; --btn-pri-fg: #1a1030; --btn-sec-bg: transparent; --btn-sec-fg: #eef0f8;
  --card-hover: translateY(-2px); --row-title: 1.55rem;
}

/* ---- 25) ลูกกวาด (mosaic, สว่าง) ---- */
[data-theme="candy"] {
  --bg: #fff6e9; --bg2: #ffefd6; --surface: #ffffff; --surface2: #ffe4bf; --text: #2b1a3a; --muted: #7a6488;
  --accent: #ff4f7b; --accent2: #ffb800; --on-accent: #fff; --border: rgba(43,26,58,.16);
  --font: 'Mitr', system-ui, sans-serif;
  --radius: 22px; --card-radius: 16px; --btn-radius: 14px; --chip-radius: 999px;
  --header-bg: #fff6e9; --header-solid: #fff6e9;
  --btn-pri-bg: #ff4f7b; --btn-pri-fg: #fff; --btn-sec-bg: #fff; --btn-sec-fg: #2b1a3a;
  --card-hover: translate(-3px, -3px); --title-weight: 600;
  --pop-ink: #2b1a3a; --pop-shadow: 5px 5px 0 #2b1a3a; --shadow: 0 6px 18px rgba(43,26,58,.1);
}
[data-theme="candy"] .logo-text { color: var(--accent); font-weight: 700; }

/* ---- 26) การ์ตูน (mosaic, มืด น้ำเงิน เหลืองสด) ---- */
[data-theme="comic"] {
  --bg: #0f2a44; --bg2: #0c2339; --surface: #173a5c; --surface2: #20496f; --muted: #b9cde0;
  --accent: #ffd23f; --accent2: #ff5d73; --on-accent: #0f2a44; --border: rgba(255,255,255,.18);
  --font: 'Kanit', system-ui, sans-serif;
  --radius: 18px; --card-radius: 12px; --btn-radius: 12px; --chip-radius: 999px;
  --header-bg: #0f2a44; --header-solid: #0f2a44;
  --btn-pri-bg: #ffd23f; --btn-pri-fg: #0f2a44; --btn-sec-bg: #fff; --btn-sec-fg: #0f2a44;
  --card-hover: translate(-3px, -3px); --title-weight: 700;
  --pop-ink: #06182a; --pop-shadow: 5px 5px 0 #06182a;
}
[data-theme="comic"] .logo-text { color: var(--accent); font-weight: 800; text-shadow: 3px 3px 0 #06182a; }

/* =========================================================
   โครง tube — หน้าตาแบบเว็บวิดีโอ (2026-11-16 เจ้าของสั่ง "เปลี่ยนหน้าตาเว็บไปได้เลย")
   ธีม: tube (สว่าง) · tubenight (มืด) · หัวเว็บช่องค้นหากลาง + แถบเมนูซ้ายถาวร (คอม) + ปกแนวนอน 16:9
   หน้าดู = viewWatchTube ใน app.js (ทุกตอนเล่นต่อกันในตัวเล่นเดียว)
   ========================================================= */
[data-theme="tube"] {
  --bg: #ffffff; --bg2: #ffffff; --surface: #f2f2f2; --surface2: #e5e5e5; --text: #0f0f0f; --muted: #606060;
  --accent: #ff0000; --accent2: #cc0000; --on-accent: #fff; --border: rgba(0,0,0,.1);
  --header-bg: #fff; --header-solid: #fff; --tube-line: #ccc; --tube-btn: #f8f8f8;
  --btn-pri-bg: #0f0f0f; --btn-pri-fg: #fff; --btn-sec-bg: #f2f2f2; --btn-sec-fg: #0f0f0f;
  --shadow: 0 4px 32px rgba(0,0,0,.1);
  color-scheme: light;
}
[data-theme="tubenight"] {
  --bg: #0f0f0f; --bg2: #0f0f0f; --surface: #272727; --surface2: #3f3f3f; --text: #f1f1f1; --muted: #aaaaaa;
  --accent: #ff0000; --accent2: #cc0000; --on-accent: #fff; --border: rgba(255,255,255,.1);
  --header-bg: #0f0f0f; --header-solid: #0f0f0f; --tube-line: #303030; --tube-btn: #222222;
  --btn-pri-bg: #f1f1f1; --btn-pri-fg: #0f0f0f; --btn-sec-bg: #272727; --btn-sec-fg: #f1f1f1;
  --shadow: 0 4px 32px rgba(0,0,0,.5);
}
[data-layout="tube"] {
  --font: 'Roboto', 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 12px; --card-radius: 12px; --btn-radius: 999px; --chip-radius: 8px;
  --header-h: 56px; --gutter: 24px; --card-w: 320px; --card-gap: 16px; --card-hover: none;
  --row-title: 1.25rem; --title-weight: 700; --page-bg: var(--bg); --tube-side: 240px;
}
[data-layout="tube"] body.watching { --page-bg: var(--bg); }
/* หน้าดูแบบเล่นต่อเนื่อง (ทุกธีมใช้แล้ว) มีข้อความใต้ตัวเล่น → พื้นตามธีม ไม่ใช่ดำล้วน — เดิมธีมสว่าง (paper/mint/sakura…) ตัวหนังสือเข้มบนพื้นดำ อ่านไม่ออก (2026-11-16) */
body.watching:has(.tw) { --page-bg: var(--bg); }

/* ---------- หัวเว็บ ---------- */
[data-layout="tube"] #top { margin-bottom: 0; background: var(--bg) !important; box-shadow: none !important; }
[data-layout="tube"] body.no-hero #app { padding-top: 0; }
[data-layout="tube"] .bar { gap: 8px; padding: 0 16px; }
[data-layout="tube"] .burger { display: inline-flex; }
[data-layout="tube"] .icon-btn:hover { background: var(--surface); }
[data-layout="tube"] .bar .nav, [data-layout="tube"] .bar .spacer { display: none; }
[data-layout="tube"] .logo { margin-right: 12px; }
[data-layout="tube"] .logo-text { color: var(--text); font-size: 1.32rem; font-weight: 700; letter-spacing: -.045em; display: inline-flex; align-items: center; gap: 4px; }
[data-layout="tube"] .logo-text::before { content: "\f04b"; font-family: 'Font Awesome 6 Free'; font-weight: 900; display: inline-grid; place-items: center; width: 30px; height: 21px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 10px; letter-spacing: 0; }
[data-layout="tube"] .bar .search { flex: 0 1 640px; width: auto; margin: 0 auto; height: 40px; padding: 0 0 0 16px; background: var(--bg); border: 1px solid var(--tube-line); border-radius: 40px; overflow: hidden; }
[data-layout="tube"] .bar .search:focus-within { width: auto; border-color: #1c62b9; box-shadow: inset 0 1px 2px rgba(0,0,0,.15); }
[data-layout="tube"] .bar .search input { color: var(--text); font-size: 1rem; }
[data-layout="tube"] .bar .search button { width: 64px; height: 100%; justify-content: center; align-items: center; padding: 0; background: var(--tube-btn); border-left: 1px solid var(--tube-line); }
[data-layout="tube"] .bar .search button:hover { background: var(--surface); }
[data-layout="tube"] #bottom-nav { background: var(--bg); border-top: 1px solid var(--border); }
[data-layout="tube"] #bottom-nav a.on { color: var(--text); }

/* ---------- แถบเมนูซ้าย: คอม = ถาวร (กดปุ่มเมนู = ย่อเหลือไอคอน) · หน้าดู/มือถือ = ลิ้นชักเดิม ---------- */
[data-layout="tube"] #drawer { background: var(--bg); color: var(--text); }
[data-layout="tube"] .drawer-links a { gap: 24px; height: 40px; padding: 0 12px; border-radius: 10px; font-size: .9rem; }
[data-layout="tube"] .drawer-links a.on { background: var(--surface); font-weight: 600; }
[data-layout="tube"] .drawer-links a:hover { background: var(--surface); }
[data-layout="tube"] .drawer-sec { text-transform: none; letter-spacing: 0; font-size: 1rem; font-weight: 600; color: var(--text); border-top: 1px solid var(--border); padding: 14px 12px 0; margin: 12px 0 8px; }
[data-layout="tube"] .drawer-genres { padding: 0 8px; }
@media (min-width: 1100px) {
  [data-layout="tube"] body:not(.watching) #drawer { transform: none; top: var(--header-h); bottom: 0; width: var(--tube-side); z-index: 40; padding: 12px 12px 24px; box-shadow: none; border: 0; scrollbar-width: thin; }
  [data-layout="tube"] body:not(.watching) #drawer > .drawer-h, [data-layout="tube"] body:not(.watching) #drawer > form.search { display: none !important; }
  [data-layout="tube"] body:not(.watching) #scrim { display: none; }
  [data-layout="tube"] body:not(.watching) :is(#app, #foot) { margin-left: var(--tube-side); }
  [data-layout="tube"] body.side-mini:not(.watching) { --tube-side: 72px; }
  [data-layout="tube"] body.side-mini:not(.watching) #drawer { padding: 4px; overflow: hidden; }
  [data-layout="tube"] body.side-mini:not(.watching) .drawer-links a { flex-direction: column; justify-content: center; gap: 6px; height: 74px; padding: 0; font-size: .62rem; text-align: center; }
  [data-layout="tube"] body.side-mini:not(.watching) .drawer-links a .ico { font-size: 1.25rem; }
  [data-layout="tube"] body.side-mini:not(.watching) #drawer > :not(.drawer-links) { display: none !important; }
}

/* ---------- หน้าแรก: แถบหมวด (ชิป) ติดบน + ตารางปกแนวนอน ---------- */
[data-layout="tube"] .rows { padding-bottom: 40px; }
[data-layout="tube"] .rows > .blk[data-bt="genres"]:first-child { position: sticky; top: var(--header-h); z-index: 30; background: var(--bg); padding: 12px 0; margin-bottom: 12px; }
[data-layout="tube"] .rows > .blk[data-bt="genres"]:first-child .row { margin: 0; }
[data-layout="tube"] .rows > .blk[data-bt="genres"]:first-child .row-h { display: none; }
[data-layout="tube"] .rows > .blk[data-bt="genres"]:first-child .chips.wrap { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 12px; padding-top: 0; padding-bottom: 0; }
[data-layout="tube"] .rows > .blk[data-bt="genres"]:first-child .chips.wrap::-webkit-scrollbar { display: none; }
[data-layout="tube"] .chip { background: var(--surface); color: var(--text); border: 0; border-radius: 8px; height: 32px; padding: 0 12px; display: inline-flex; align-items: center; font-size: .88rem; font-weight: 500; white-space: nowrap; flex: none; }
[data-layout="tube"] .chip:hover { background: var(--surface2); }
[data-layout="tube"] .chip.on, [data-layout="tube"] .chip.all { background: var(--text); color: var(--bg); }
[data-layout="tube"] .chip small { display: none; }
[data-layout="tube"] .row-h h2 { font-size: var(--row-title); font-weight: 700; }
[data-layout="tube"] .row-h a { color: #065fd4; font-weight: 500; font-size: .9rem; }
[data-layout="tube"][data-theme="tubenight"] .row-h a { color: #3ea6ff; }
[data-layout="tube"] .blk + .blk:not([data-bt="ad"]) > .row:not(.blk-genres) { border-top: 4px solid var(--surface); padding-top: 22px; }
[data-layout="tube"] .bgrid, [data-layout="tube"] .grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 40px 16px; }
[data-layout="tube"] .rail { gap: 16px; }
[data-layout="tube"] .rail-btn { background: var(--bg); color: var(--text); box-shadow: 0 4px 4px rgba(0,0,0,.3), 0 0 4px rgba(0,0,0,.2); border-radius: 50%; width: 40px; height: 40px; }
[data-layout="tube"] .sk { background: linear-gradient(90deg, var(--surface) 0%, var(--surface2) 50%, var(--surface) 100%); background-size: 200% 100%; }
[data-layout="tube"] .sk-card { aspect-ratio: 16/9; }
[data-layout="tube"] .ptile { background: var(--surface); color: var(--text); box-shadow: none; }
[data-layout="tube"] .badge.sub { background: var(--text); color: var(--bg); }
[data-layout="tube"] .badge.out { color: var(--text); }
[data-layout="tube"] :is(.dd-menu, .modal-box) { background: var(--bg2); color: var(--text); }
[data-layout="tube"] .card.rank .num { -webkit-text-stroke: 3px color-mix(in srgb, var(--text) 55%, transparent); color: var(--bg); }

/* การ์ดแบบวิดีโอ: ปก 16:9 (ภาพแนวตั้งวางกลาง พื้นหลังเบลอ) + รูปช่อง + ชื่อ 2 บรรทัด + ค่าย + ยอดดู */
.tcard .poster { aspect-ratio: 16/9; border-radius: 12px; background: #000; box-shadow: none; }
.tcard .poster::before { content: ""; position: absolute; inset: -20px; background: var(--img) center / cover; filter: blur(18px) brightness(.62); }
.tcard .poster img { width: auto; height: 100%; margin: 0 auto; object-fit: contain; }
.tcard .poster .eps { right: 8px; bottom: 8px; font-size: .75rem; font-weight: 600; padding: 1px 5px; background: rgba(0,0,0,.8); }
.tcard .poster .badge { top: 8px; left: 8px; }
.tcard:hover .poster img { transform: none; }
.tmeta { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.tmeta .t { font-size: 1rem; font-weight: 600; line-height: 1.4; }
.tmeta .s { font-size: .86rem; margin-top: 2px; }
.tav { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; background: hsl(var(--h, 0) 55% 45%); color: #fff; font-weight: 700; font-size: .95rem; flex: none; }
img.tav { background: var(--surface); }

/* ---------- หน้าดู ---------- */
.tw { display: grid; grid-template-columns: minmax(0, 1fr) 402px; gap: 24px; padding: 24px 24px 48px; max-width: 1754px; margin: 0 auto; }
.tw-player { position: relative; aspect-ratio: 16/9; max-height: calc(100svh - var(--header-h) - 130px); width: 100%; background: #000; border-radius: 12px; overflow: hidden; }
.tw-player > .vp, .tw-player > .vp-mount { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; }
.tw-player > .vp.vp-fs, .tw-player > .vp:fullscreen { position: fixed; }
.tw-player .vp-title { display: none; }
.tw-player .loading { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; pointer-events: none; background: #000; }
.tw-over { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.86); color: #fff; text-align: center; }
.tw-over .err, .tw-over .lockbox { position: static; background: none; color: #fff; }
.tw-end { display: grid; justify-items: center; gap: 6px; }
.tw-end .ico { font-size: 2rem; color: var(--accent); }
.tw-end b { font-size: 1.2rem; }
.tw-end span { color: #bbb; font-size: .9rem; }
.tw-badge { position: absolute; left: 14px; top: 14px; z-index: 4; background: rgba(0,0,0,.72); color: #fff; padding: 6px 12px; border-radius: 8px; font-size: .9rem; font-weight: 500; pointer-events: none; }
.tw-chain { display: flex; gap: 2px; height: 6px; margin-top: 12px; }
.tw-seg { position: relative; flex: 1 1 0; min-width: 0; border: 0; padding: 0; background: var(--surface2); border-radius: 2px; overflow: hidden; transition: transform .12s; }
.tw-seg i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); }
.tw-seg.done i { width: 100%; }
.tw-seg.cur { background: color-mix(in srgb, var(--accent) 28%, var(--surface2)); }
.tw-seg.lk { background: repeating-linear-gradient(135deg, var(--surface2) 0 3px, transparent 3px 6px); }
.tw-seg:hover { transform: scaleY(1.7); }
.tw-chain-l { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; font-size: .8rem; color: var(--muted); }
.tw-title { font-size: 1.25rem; font-weight: 700; line-height: 1.4; margin: 12px 0 0; }
.tw-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.tw-ch { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tw-ch .tav { width: 40px; height: 40px; }
.tw-ch b { display: block; font-size: 1rem; }
.tw-ch small { color: var(--muted); font-size: .78rem; }
.tw-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.tw-acts .btn { height: 36px; padding: 0 16px; border-radius: 18px; background: var(--surface); color: var(--text); font-size: .88rem; font-weight: 500; border: 0; }
.tw-acts .btn:hover { background: var(--surface2); }
.tw-desc { margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--surface); font-size: .9rem; cursor: pointer; }
.tw-desc:hover { background: var(--surface2); }
.tw-desc p { margin: 6px 0 0; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tw-desc.open p { display: block; }
.tw-desc .chips { margin-top: 10px; flex-wrap: wrap; gap: 8px; }
.tw-desc .chip { background: var(--bg); }
.tw-main > .notice { margin-top: 12px; }
.tw-pl { display: flex; flex-direction: column; max-height: min(72svh, 600px); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.tw-plh { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 16px; background: var(--surface); }
.tw-plh > div { min-width: 0; }
.tw-plh b { display: block; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-plh span { font-size: .8rem; color: var(--muted); }
.tw-auto { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--muted); cursor: pointer; flex: none; }
.tw-auto input { position: absolute; opacity: 0; pointer-events: none; }
.tw-auto i { position: relative; width: 36px; height: 14px; border-radius: 7px; background: var(--surface2); transition: background .2s; }
.tw-auto i::after { content: ""; position: absolute; top: -3px; left: -2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .2s; }
.tw-auto input:checked + i { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.tw-auto input:checked + i::after { transform: translateX(20px); background: var(--accent); }
.tw-auto input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 3px; }
.tw-pll { flex: 1; overflow-y: auto; padding: 6px 0; scrollbar-width: thin; }
.tw-it { display: grid; grid-template-columns: 26px 100px minmax(0, 1fr); gap: 8px; align-items: center; padding: 4px 10px 4px 4px; }
.tw-it:hover { background: var(--surface); }
.tw-it.cur { background: color-mix(in srgb, var(--accent) 10%, var(--bg)); }
.tw-n { font-size: .75rem; color: var(--muted); text-align: center; }
.tw-it.cur .tw-n { font-size: 0; }
.tw-it.cur .tw-n::before { content: "\f04b"; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: .7rem; color: var(--accent); }
.tw-th { position: relative; display: block; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: #000; }
.tw-th::before { content: ""; position: absolute; inset: -14px; background: var(--img) center / cover; filter: blur(12px) brightness(.6); }
.tw-th img { position: relative; height: 100%; width: auto; margin: 0 auto; object-fit: contain; }
.tw-th em { position: absolute; right: 4px; bottom: 4px; padding: 0 4px; border-radius: 4px; background: rgba(0,0,0,.8); color: #fff; font-size: .7rem; font-style: normal; font-weight: 600; }
.tw-it.seen .tw-th::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent); }
.tw-it-t { min-width: 0; }
.tw-it-t b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .86rem; font-weight: 600; line-height: 1.35; }
.tw-it-t small { display: block; color: var(--muted); font-size: .76rem; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-it.lk small { color: var(--accent); }
.tw-it.na { opacity: .45; }
.tw-h { font-size: 1.05rem; margin: 24px 0 10px; }
.tw-rel { display: grid; gap: 8px; }
.tw-ri { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 8px; align-items: start; border-radius: 8px; }
.tw-ri .tw-it-t b { font-size: .9rem; }
@media (max-width: 1000px) {
  .tw { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 0 40px; }
  .tw-player { position: sticky; top: var(--header-h); z-index: 20; border-radius: 0; max-height: none; }
  .tw-main > :not(.tw-player) { margin-left: 12px; margin-right: 12px; }
  .tw-chain { margin-top: 0; height: 4px; gap: 1px; }
  .tw-chain .tw-seg { border-radius: 0; }
  .tw-title { font-size: 1.1rem; }
  .tw-side { padding: 16px 12px 0; }
  .tw-pl { max-height: 440px; }
}
@media (max-width: 760px) {
  [data-layout="tube"] { --gutter: 12px; --card-w: 78vw; }
  [data-layout="tube"] .bar .search { display: none; }
  [data-layout="tube"] .bgrid, [data-layout="tube"] .grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .tw-ri { grid-template-columns: 140px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .tw-seg, .tw-auto i, .tw-auto i::after { transition: none; } }

/* ---- ตัวเล่นแบบไฟล์เดียวยาว (โครง tube, 2026-11-16) — <video> สองชั้นสลับกัน + แถบเวลาทั้งเรื่อง ---- */
.lp { user-select: none; -webkit-user-select: none; color: #fff; }
.lp-v { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; opacity: 0; pointer-events: none; }
.lp-v.on { opacity: 1; }
.lp-v::cue { background: rgba(0,0,0,.55); color: #fff; font-family: inherit; font-size: clamp(14px, 2.4vw, 22px); }
.lp .loading { background: transparent; z-index: 3; }
.lp-hit { position: absolute; inset: 0; z-index: 2; cursor: pointer; }
.lp-big { position: absolute; left: 50%; top: 50%; z-index: 4; width: 68px; height: 48px; margin: -24px 0 0 -34px; border: 0; border-radius: 14px; background: rgba(255,0,0,.92); color: #fff; font-size: 1.3rem; cursor: pointer; display: none; }
.lp.lp-paused .lp-big { display: block; }
.lp-ctl { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; padding: 26px 12px 6px; background: linear-gradient(transparent, rgba(0,0,0,.72)); transition: opacity .25s; }
.lp.lp-idle .lp-ctl { opacity: 0; pointer-events: none; }
.lp.lp-idle { cursor: none; }
.lp-bar { position: relative; display: flex; gap: 2px; height: 16px; align-items: center; cursor: pointer; touch-action: none; outline: none; }
.lp-seg { position: relative; flex: 1 1 0; min-width: 1px; height: 4px; background: rgba(255,255,255,.28); transition: height .12s; overflow: hidden; }
.lp-seg.lk { background: repeating-linear-gradient(135deg, rgba(255,255,255,.3) 0 3px, transparent 3px 6px); }
.lp-seg i { position: absolute; inset: 0 auto 0 0; width: 0; }
.lp-buf { background: rgba(255,255,255,.45); }
.lp-fill { background: #f00; }
.lp-bar:hover .lp-seg, .lp-bar:focus-visible .lp-seg { height: 6px; }
.lp-seg.hov { height: 8px !important; }
.lp-bar:focus-visible { box-shadow: 0 0 0 2px #fff; border-radius: 2px; }
.lp-tip { position: absolute; bottom: 20px; transform: translateX(-50%); padding: 4px 8px; border-radius: 6px; background: rgba(28,28,28,.92); font-size: .8rem; white-space: nowrap; pointer-events: none; }
.lp-row { display: flex; align-items: center; gap: 2px; height: 42px; }
.lp-b { display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 6px; border: 0; background: none; color: #fff; font: inherit; font-size: 1.05rem; cursor: pointer; border-radius: 8px; }
.lp-b:hover { background: rgba(255,255,255,.12); }
.lp-b:focus-visible { outline: 2px solid #fff; }
.lp-rate { font-size: .85rem; font-weight: 600; }
.lp-cc.on { box-shadow: inset 0 -3px 0 #f00; }
.lp .lp-pa, .lp.lp-paused .lp-pi { display: inline; } .lp .lp-pi, .lp.lp-paused .lp-pa { display: none; }
.lp .lp-voff, .lp.lp-muted .lp-von { display: none; } .lp.lp-muted .lp-voff { display: inline; }
.lp .lp-foff, .lp.lp-fs .lp-fon { display: none; } .lp.lp-fs .lp-foff { display: inline; }
.lp-vol { display: flex; align-items: center; }
.lp-vol input { width: 0; opacity: 0; transition: width .2s, opacity .2s; accent-color: #fff; }
.lp-vol:hover input, .lp-vol:focus-within input { width: 72px; opacity: 1; margin-right: 6px; }
.lp-time { margin-left: 6px; font-size: .86rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lp-time > span { color: rgba(255,255,255,.75); }
.lp-ep { margin-left: 10px; padding: 2px 8px; border-radius: 6px; background: rgba(255,255,255,.14); font-size: .78rem; white-space: nowrap; }
.lp-sp { flex: 1; }
.tw-player.lp.lp-fs { border-radius: 0; max-height: none; aspect-ratio: auto; }
.tw-over .tw-end { display: grid; gap: 8px; justify-items: center; }
.tw-over .tw-end b { font-size: 1.15rem; }
.tw-over .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
@media (max-width: 760px) {
  .lp-ctl { padding: 18px 6px 2px; }
  .lp-vol input, .lp-ep, .lp-rate { display: none; }
  .lp-b { min-width: 36px; height: 36px; }
  .lp-time { font-size: .78rem; }
  .lp-seg { height: 3px; }
}
@media (hover: none) { .lp.lp-idle .lp-ctl { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .lp-ctl, .lp-seg, .lp-vol input { transition: none; } }
.lp-v::-webkit-media-text-track-container { transition: transform .25s; }
.lp:not(.lp-idle):not(.lp-paused) .lp-v::-webkit-media-text-track-container, .lp.lp-paused .lp-v::-webkit-media-text-track-container { transform: translateY(-58px); }
@media (max-width: 760px) { .lp:not(.lp-idle) .lp-v::-webkit-media-text-track-container { transform: translateY(-44px); } }

/* ธีม tube (2026-11-16 เจ้าของสั่ง): ปกแนวตั้ง 3:4 + ตัวเล่นแนวตั้ง/แนวนอนตามหนัง (.port) */
.tcard .poster { aspect-ratio: 3/4; }
.tcard .poster::before { display: none; }
.tcard .poster img { width: 100%; height: 100%; object-fit: cover; }
[data-layout="tube"] .sk-card { aspect-ratio: 3/4; }
[data-layout="tube"] .bgrid, [data-layout="tube"] .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 28px 14px; }
[data-layout="tube"] .tmeta { grid-template-columns: 28px minmax(0, 1fr); gap: 8px; margin-top: 10px; }
[data-layout="tube"] .tmeta .tav { width: 28px; height: 28px; font-size: .8rem; }
[data-layout="tube"] .tmeta .t { font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
[data-layout="tube"] .tmeta .s { font-size: .8rem; }
.tw-player.port { aspect-ratio: 9/16; width: auto; height: calc(100svh - var(--header-h) - 130px); max-width: 100%; margin: 0 auto; }
.tw-player.port.lp-fs { width: 100%; height: 100%; aspect-ratio: auto; }
@media (max-width: 1000px) {
  .tw-player.port { width: 100%; height: auto; max-height: 68svh; }
}
@media (max-width: 760px) {
  [data-layout="tube"] .bgrid, [data-layout="tube"] .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 10px; }
}
/* หน้าหมวดหมู่/ค่าย: ตัวหนังสือบนการ์ดสีเข้มต้องเป็นสีขาวทุกธีม (ธีมสว่างเคยเป็นตัวดำกลืนพื้น) */
.gtile, .gtile b, .gtile span { color: #fff; }
.gtile { text-shadow: 0 1px 2px rgba(0,0,0,.35); }
[data-layout="tube"] { --card-w: 200px; }
[data-layout="tube"] .bar .acct-slot { margin-left: auto; }
@media (max-width: 760px) { [data-layout="tube"] { --card-w: 42vw; } }
/* แผงเลือกตอนในตัวเล่น — ทุกธีม (2026-11-16) */
.lp-epsb { gap: 6px; grid-auto-flow: column; font-size: .88rem; font-weight: 600; }
.lp-eps { position: absolute; top: 0; right: 0; bottom: 0; z-index: 7; width: min(340px, 100%); display: flex; flex-direction: column; background: rgba(15,15,15,.94); backdrop-filter: blur(6px); }
.lp-eps[hidden] { display: none; }
.lp-eps-h { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 16px; border-bottom: 1px solid rgba(255,255,255,.12); }
.lp-eps-h span { color: rgba(255,255,255,.6); font-size: .82rem; margin-right: auto; }
.lp-eps-g { flex: 1; overflow-y: auto; padding: 12px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; align-content: start; overscroll-behavior: contain; }
.lp-en { height: 40px; border: 0; border-radius: 8px; background: rgba(255,255,255,.1); color: #fff; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; }
.lp-en:hover { background: rgba(255,255,255,.2); }
.lp-en:focus-visible { outline: 2px solid #fff; }
.lp-en.seen { color: rgba(255,255,255,.55); }
.lp-en.cur { background: var(--accent, #f00); color: var(--on-accent, #fff); }
.lp-en.lk { font-size: .78rem; }
.lp-en.na { opacity: .35; }
.lp.lp-epsopen .lp-ctl { opacity: 1; pointer-events: auto; }
@media (max-width: 520px) { .lp-epsb span { display: none; } .lp-eps-g { grid-template-columns: repeat(4, minmax(0, 1fr)); } .lp-row .lp-ep { display: none; } }

/* ★ 2026-11-16 (เจ้าของสั่ง): มือถือ = แถวละ 2 เรื่องทุกธีม (กริด + แถวเลื่อนเห็น 2 ใบ) */
@media (max-width: 760px) {
  :root:not([data-layout="tube"]) .grid, :root:not([data-layout="tube"]) .bgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 10px; }
  :root:not([data-layout="tube"]):not([data-cards="landscape"]) { --card-w: 42vw; }
}

/* ★ 2026-11-16: หน้าดู — "แนะนำสำหรับคุณ" 10 เรื่องใต้ข้อมูลเรื่อง (คอลัมน์ซ้าย) · แผงด้านข้างกินสองแถว ไม่ดันช่องว่าง · มือถืออยู่ท้ายสุด */
.tw { grid-template-rows: auto 1fr; }
.tw > .tw-main { grid-column: 1; grid-row: 1; }
.tw > .tw-side { grid-column: 2; grid-row: 1 / span 2; }
.tw > .tw-rec { grid-column: 1; grid-row: 2; align-self: start; min-width: 0; }
.tw-rec > .tw-h { margin-top: 8px; }
@media (max-width: 1000px) {
  .tw { grid-template-rows: none; }
  .tw > .tw-main, .tw > .tw-side, .tw > .tw-rec { grid-column: 1; grid-row: auto; }
  .tw-rec { padding: 8px 12px 0; }
}
@media (max-width: 760px) {
  .tw-rec .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 10px; }
}

/* เรื่องอื่นที่น่าสนใจ ใต้รายการตอน — ธีมอื่นที่ไม่ใช่ YouTube (2026-11-16) */
.w-more:empty { display: none; }
.w-more .tw-ri { grid-template-columns: 132px minmax(0, 1fr); padding: 2px; }
.w-more .tw-ri:hover { background: rgba(127,127,127,.12); }
@media (max-width: 760px) { .w-more .tw-ri { grid-template-columns: 144px minmax(0, 1fr); } }

/* แถบควบคุมตัวเล่นธีม YouTube ปรับตามความกว้างของตัวเล่นเอง (2026-11-16 — จอใหญ่ + วิดีโอแนวตั้ง ตัวเล่นแคบ ปุ่มขวาล้น) */
.lp-ctl { container-type: inline-size; }
@container (max-width: 600px) {
  .lp-ep, .lp-epsb span { display: none; }
  .lp-vol:hover input, .lp-vol:focus-within input { width: 52px; }
}
@container (max-width: 470px) {
  .lp-vol input, .lp-rate { display: none; }
  .lp-b { min-width: 34px; padding: 0 4px; font-size: .98rem; }
  .lp-time { margin-left: 2px; font-size: .78rem; }
}
@container (max-width: 340px) {
  .lp-row [data-lp="next"] { display: none; }
}

/* เล่นเองแบบปิดเสียง (เบราว์เซอร์บล็อกเสียง) → ปุ่มเปิดเสียงมุมซ้ายบน แบบ YouTube (2026-11-16) */
.lp-unmute { position: absolute; left: 12px; top: 12px; z-index: 7; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 0; border-radius: 6px; background: rgba(255,255,255,.92); color: #0f0f0f; font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.lp-unmute[hidden] { display: none; }

/* =========================================================
   โครง swipe — คลิปสั้นแนวตั้งทั้งเว็บ (2026-11-17 เจ้าของสั่ง "ธีมแบบคลิปสั้น ทั้งเว็บต้องเปลี่ยนโครง")
   ธีม: clip (มืด) · cliplight (สว่าง — หน้าฟีด/หน้าดูยังพื้นดำ)
   app.js: viewFeed (หน้าแรก) · viewWatchSwipe (หน้าดู) · viewTitleSwipe (หน้าเรื่อง) · swipeDeck (ตัวเล่นแบบปัด) · การ์ด .scard
   ========================================================= */
[data-theme="clip"] {
  --bg: #000000; --bg2: #121212; --surface: #1f1f23; --surface2: #2f2f35; --text: #ffffff; --muted: rgba(255,255,255,.6);
  --accent: #fe2c55; --accent2: #25f4ee; --on-accent: #fff; --border: rgba(255,255,255,.12);
  --header-bg: #000; --header-solid: #000;
  --btn-pri-bg: var(--accent); --btn-pri-fg: #fff; --btn-sec-bg: rgba(255,255,255,.12); --btn-sec-fg: #fff;
  --shadow: 0 8px 40px rgba(0,0,0,.6);
}
[data-theme="cliplight"] {
  --bg: #ffffff; --bg2: #ffffff; --surface: #f1f1f2; --surface2: #e3e3e4; --text: #161823; --muted: rgba(22,24,35,.6);
  --accent: #fe2c55; --accent2: #25f4ee; --on-accent: #fff; --border: rgba(22,24,35,.12);
  --header-bg: #fff; --header-solid: #fff;
  --btn-pri-bg: var(--accent); --btn-pri-fg: #fff; --btn-sec-bg: #f1f1f2; --btn-sec-fg: #161823;
  --shadow: 0 8px 40px rgba(0,0,0,.12);
  color-scheme: light;
}
[data-layout="swipe"] {
  --font: 'IBM Plex Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 8px; --card-radius: 6px; --btn-radius: 6px; --chip-radius: 999px;
  --header-h: 60px; --gutter: 24px; --card-w: 170px; --card-gap: 12px; --card-hover: none;
  --title-weight: 700; --page-bg: var(--bg); --sw-side: 240px;
  --deck-h: calc(100svh - var(--header-h));
}
[data-layout="swipe"] body.watching { --page-bg: #000; }

/* ---------- หัวเว็บ + เมนูซ้าย (คอม) ---------- */
[data-layout="swipe"] #top { margin-bottom: 0; background: var(--bg) !important; box-shadow: 0 1px 0 var(--border) !important; }
[data-layout="swipe"] body.no-hero #app { padding-top: 0; }
[data-layout="swipe"] .bar { gap: 10px; padding: 0 16px; }
[data-layout="swipe"] .bar .nav, [data-layout="swipe"] .bar .spacer { display: none; }
[data-layout="swipe"] .logo-text { color: var(--text); font-size: 1.35rem; font-weight: 700; letter-spacing: -.03em; display: inline-flex; align-items: center; gap: 8px; }
[data-layout="swipe"] .logo-text::before { content: "\f04b"; font-family: 'Font Awesome 6 Free'; font-weight: 900; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 12px; box-shadow: -3px -2px 0 var(--accent2); }
[data-layout="swipe"] .bar .search { flex: 0 1 520px; width: auto; margin: 0 auto; height: 44px; padding: 0 0 0 18px; background: var(--surface); border: 1.5px solid transparent; border-radius: 44px; overflow: hidden; }
[data-layout="swipe"] .bar .search:focus-within { width: auto; border-color: var(--border); }
[data-layout="swipe"] .bar .search input { color: var(--text); font-size: 1rem; }
[data-layout="swipe"] .bar .search button { width: 54px; height: 100%; justify-content: center; align-items: center; padding: 0; border-left: 1px solid var(--border); color: var(--muted); }
[data-layout="swipe"] #drawer { background: var(--bg); color: var(--text); }
[data-layout="swipe"] .drawer-links a { gap: 14px; height: 48px; padding: 0 12px; border-radius: 8px; font-size: 1.05rem; font-weight: 600; }
[data-layout="swipe"] .drawer-links a .ico { font-size: 1.3rem; width: 28px; }
[data-layout="swipe"] .drawer-links a.on { color: var(--accent); }
[data-layout="swipe"] .drawer-links a:hover { background: var(--surface); }
[data-layout="swipe"] .drawer-sec { text-transform: none; letter-spacing: 0; font-size: .9rem; font-weight: 600; color: var(--muted); border-top: 1px solid var(--border); padding: 14px 12px 0; margin: 12px 0 8px; }
[data-layout="swipe"] .drawer-genres { padding: 0 8px; }
@media (min-width: 1100px) {
  [data-layout="swipe"] body:not(.watching) #drawer { transform: none; top: var(--header-h); bottom: 0; width: var(--sw-side); z-index: 40; padding: 12px 12px 24px; box-shadow: none; border: 0; border-right: 1px solid var(--border); scrollbar-width: thin; }
  [data-layout="swipe"] body:not(.watching) #drawer > .drawer-h, [data-layout="swipe"] body:not(.watching) #drawer > form.search { display: none !important; }
  [data-layout="swipe"] body:not(.watching) #scrim { display: none; }
  [data-layout="swipe"] body:not(.watching) :is(#app, #foot) { margin-left: var(--sw-side); }
  [data-layout="swipe"] body.side-mini:not(.watching) { --sw-side: 72px; }
  [data-layout="swipe"] body.side-mini:not(.watching) #drawer { padding: 8px 4px; overflow: hidden; }
  [data-layout="swipe"] body.side-mini:not(.watching) .drawer-links a { justify-content: center; padding: 0; font-size: 0; }
  [data-layout="swipe"] body.side-mini:not(.watching) .drawer-links a .ico { font-size: 1.3rem; }
  [data-layout="swipe"] body.side-mini:not(.watching) #drawer > :not(.drawer-links) { display: none !important; }
}

/* ---------- แถบล่าง (มือถือ) ---------- */
[data-layout="swipe"] #bottom-nav :is([data-nav="genres"], [data-nav="search"], [data-nav="trending"]):not(.bn-x) { display: none !important; }
[data-layout="swipe"] #bottom-nav .bn-x { display: flex !important; }
[data-layout="swipe"] #bottom-nav { background: var(--bg); border-top: 1px solid var(--border); backdrop-filter: none; }
[data-layout="swipe"] #bottom-nav a { color: var(--muted); font-weight: 500; }
[data-layout="swipe"] #bottom-nav a.on { color: var(--text); }
[data-layout="swipe"] #bottom-nav [data-nav="home"] { order: 1; }
[data-layout="swipe"] #bottom-nav [data-nav="explore"] { order: 2; }
[data-layout="swipe"] #bottom-nav .bn-shuffle { order: 3; }
[data-layout="swipe"] #bottom-nav [data-nav="mylist"] { order: 4; }
[data-layout="swipe"] #bottom-nav .bn-acct { order: 5; }
[data-layout="swipe"] #bottom-nav .bn-shuffle span { display: grid; place-items: center; width: 48px; height: 32px; border-radius: 10px; background: var(--accent); color: #fff; box-shadow: -3px 0 0 var(--accent2); }
[data-layout="swipe"] #bottom-nav .bn-shuffle .ico { width: auto; height: auto; font-size: 16px; }
[data-layout="swipe"] body.sw-feedp #bottom-nav { background: #000; border-top-color: rgba(255,255,255,.14); }
[data-layout="swipe"] body.sw-feedp #bottom-nav a { color: rgba(255,255,255,.6); }
[data-layout="swipe"] body.sw-feedp #bottom-nav a.on { color: #fff; }

/* ---------- ตัวเล่นแบบปัด (ฟีด + หน้าดู) ---------- */
[data-layout="swipe"] body.sw-deckp { overflow: hidden; overscroll-behavior: none; }
[data-layout="swipe"] body.sw-deckp #foot { display: none; }
[data-layout="swipe"] body.sw-watchp { --deck-h: 100svh; }
[data-layout="swipe"] body.sw-watchp #top { display: none; }
.sw-page { position: relative; }
.sw-deck { height: var(--deck-h); overflow-y: auto; overflow-x: hidden; scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none; background: #000; }
.sw-deck::-webkit-scrollbar { display: none; }
.sw-sl { position: relative; height: var(--deck-h); scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #fff; }
.sw-bg { position: absolute; inset: -60px; background: #111 var(--img) center / cover no-repeat; filter: blur(48px) brightness(.4) saturate(1.2); }
.sw-wrap { position: relative; z-index: 1; height: 100%; display: flex; align-items: flex-end; gap: 18px; padding: 16px 0; }
.sw-stage { position: relative; height: 100%; aspect-ratio: 9 / 16; max-width: calc(100vw - 120px); border-radius: 14px; overflow: hidden; background: #000; isolation: isolate; }
.sw-stage.sk { background: #161616; }
.sw-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: filter .3s, transform .3s; }
.sw-sl.sw-on .sw-poster { filter: blur(26px) brightness(.45); transform: scale(1.2); }
.sw-mount, .sw-v { position: absolute; inset: 0; width: 100%; height: 100%; }
.sw-v { object-fit: contain; background: transparent; opacity: 0; transition: opacity .15s; }
.sw-sl.sw-on .sw-v { opacity: 1; }
.sw-v::cue { font-family: var(--font); font-size: 1.05rem; line-height: 1.35; background: rgba(0,0,0,.55); }
.sw-stage::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 48%; z-index: 3; pointer-events: none; background: linear-gradient(180deg, transparent, rgba(0,0,0,.35) 40%, rgba(0,0,0,.75)); }
.sw-stage::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 120px; z-index: 3; pointer-events: none; background: linear-gradient(rgba(0,0,0,.4), transparent); }
.sw-load { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; pointer-events: none; }
.sw-load[hidden] { display: none; }
.sw-load .spin { border-color: rgba(255,255,255,.2); border-top-color: #fff; }
.sw-big { position: absolute; left: 50%; top: 50%; z-index: 4; transform: translate(-50%, -50%) scale(.8); font-size: 64px; color: rgba(255,255,255,.85); opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; filter: drop-shadow(0 2px 10px rgba(0,0,0,.5)); }
.sw-sl.sw-paused .sw-big { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.sw-heart { position: absolute; left: 50%; top: 45%; z-index: 6; width: 110px; height: 110px; margin: -55px 0 0 -55px; pointer-events: none; opacity: 0; display: grid; place-items: center; }
.sw-heart::before { content: "\f004"; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: 100px; color: var(--accent); filter: drop-shadow(0 4px 18px rgba(0,0,0,.4)); }
.sw-heart.pop { animation: sw-heart .8s ease-out; }
@keyframes sw-heart { 0% { opacity: 0; transform: scale(.4) rotate(-12deg); } 20% { opacity: 1; transform: scale(1.15) rotate(-8deg); } 40% { transform: scale(.95) rotate(-8deg); } 100% { opacity: 0; transform: scale(1.4) translateY(-60px) rotate(-8deg); } }
.sw-over { position: absolute; inset: 0; z-index: 7; display: grid; place-items: center; padding: 24px; text-align: center; background: rgba(0,0,0,.6); }
.sw-over[hidden] { display: none; }
.sw-over .err, .sw-over .sw-end { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 320px; color: #fff; background: none; border: 0; }
.sw-over .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.sw-end .ico { font-size: 40px; width: 44px; height: 44px; color: var(--accent); }
.sw-end b { font-size: 1.15rem; }
.sw-end span { opacity: .75; font-size: .9rem; }
.sw-info { position: absolute; left: 0; right: 0; bottom: 18px; z-index: 5; padding: 0 16px; text-shadow: 0 1px 2px rgba(0,0,0,.45); pointer-events: none; }
.sw-info a, .sw-info p { pointer-events: auto; }
.sw-at { display: inline-block; color: #fff; font-weight: 700; font-size: 1rem; }
.sw-t { margin: 4px 0 2px; font-size: 1.05rem; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sw-t a { color: #fff; }
.sw-ep { font-size: .82rem; opacity: .85; }
.sw-ep b { font-weight: 700; }
.sw-d { margin: 6px 0 0; font-size: .86rem; line-height: 1.45; opacity: .92; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sw-tags { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: .86rem; font-weight: 700; }
.sw-tags a { color: #fff; }
.sw-cta { margin-top: 12px; display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border-radius: 6px; background: rgba(255,255,255,.18); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: #fff; font-size: .88rem; font-weight: 600; text-shadow: none; }
.sw-cta span { flex: 1; }
.sw-cta .fa-play { color: var(--accent); }
.sw-cta:hover { background: rgba(255,255,255,.26); color: #fff; }
.sw-prog { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; height: 16px; cursor: pointer; display: flex; align-items: flex-end; touch-action: none; }
.sw-prog::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(255,255,255,.22); transition: height .12s; }
.sw-prog i { position: relative; display: block; height: 2px; width: 0; background: #fff; transition: height .12s; }
.sw-prog:hover::before, .sw-prog.drag::before, .sw-prog:hover i, .sw-prog.drag i { height: 5px; }
.sw-sl:not(.sw-act) .sw-prog { display: none; }
/* ปุ่มด้านขวา */
.sw-rail { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-bottom: 6px; }
.sw-rb { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; font: inherit; font-size: .74rem; font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; min-width: 52px; }
.sw-rb .fa-solid { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,.14); font-size: 20px; transition: transform .15s, color .15s; }
.sw-rb:hover .fa-solid { background: rgba(255,255,255,.22); }
.sw-rb:active .fa-solid { transform: scale(.88); }
.sw-rb.on[data-sw="like"] .fa-solid { color: var(--accent); animation: sw-bump .35s; }
.sw-rb.on[data-sw="fav"] .fa-solid { color: #facd00; animation: sw-bump .35s; }
@keyframes sw-bump { 50% { transform: scale(1.25); } }
.sw-av { position: relative; width: 50px; height: 50px; margin-bottom: 8px; }
.sw-av img { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; background: #222; }
.sw-avp { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; }
.sw-disc { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle, #333 30%, #111 70%); border: 8px solid #1b1b1b; margin-top: 4px; overflow: hidden; }
.sw-disc .tav { width: 26px !important; height: 26px !important; font-size: .7rem; border-radius: 50%; }
.sw-sl.sw-on:not(.sw-paused) .sw-disc { animation: sw-spin 5s linear infinite; }
@keyframes sw-spin { to { transform: rotate(360deg); } }
/* แถบบน (แท็บฟีด / หัวหน้าดู) */
.sw-top { position: absolute; z-index: 20; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 6px; padding: 10px 12px; color: #fff; pointer-events: none; }
.sw-top > * { pointer-events: auto; }
.sw-tl { flex: 1; display: flex; justify-content: safe center; gap: 4px 20px; overflow-x: auto; scrollbar-width: none; padding-left: 40px; }
.sw-tl::-webkit-scrollbar { display: none; }
.sw-tl button { position: relative; flex: none; height: 36px; padding: 0 2px; background: none; border: 0; color: rgba(255,255,255,.65); font: inherit; font-size: 1rem; font-weight: 600; cursor: pointer; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.sw-tl button.on { color: #fff; }
.sw-tl button.on::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 26px; height: 3px; margin-left: -13px; border-radius: 3px; background: #fff; }
.sw-ib { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: none; border: 0; color: #fff; font-size: 18px; cursor: pointer; text-shadow: 0 1px 3px rgba(0,0,0,.5); flex: none; }
.sw-ib:hover { background: rgba(255,255,255,.12); color: #fff; }
.sw-wt { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: center; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.sw-wt b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .98rem; }
.sw-wt span { font-size: .78rem; opacity: .8; }
.sw-nav { position: fixed; z-index: 15; right: 28px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 14px; }
.sw-nav button { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,.14); border: 0; color: #fff; font-size: 18px; cursor: pointer; }
.sw-nav button:hover { background: rgba(255,255,255,.24); }
.sw-unmute { position: absolute; z-index: 25; top: 62px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 40px; border: 0; background: rgba(0,0,0,.62); color: #fff; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.4); white-space: nowrap; }
.sw-unmute[hidden] { display: none; }
/* คลิปโฆษณา (บล็อกโฆษณาในหน้าแรก = แทรกทุก 6 คลิป) */
.sw-adsl { background: radial-gradient(circle at 50% 40%, #1d1d24, #000); }
.sw-adw { width: min(440px, 88vw); display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.sw-adw img { max-width: 100%; height: auto; border-radius: 12px; display: block; }
.sw-adw > div { width: 100%; margin: 0 !important; }
.sw-adl { font-size: .75rem; letter-spacing: .08em; opacity: .6; }
.sw-adh { font-size: .85rem; opacity: .7; display: flex; gap: 8px; align-items: center; animation: sw-hint 1.6s ease-in-out infinite; }
@keyframes sw-hint { 50% { transform: translateY(-5px); } }
/* หน้าต่างล่าง (เลือกตอน / ความคิดเห็น) */
.modal-box.sw-sheet { width: min(560px, 100%); max-height: 78vh; }
.sw-sheet h3 small { font-size: .8rem; font-weight: 500; margin-left: 8px; margin-right: auto; }
.sw-sheet .eps-grid { grid-template-columns: repeat(6, 1fr); max-height: none; }
.sw-sheet .soc-cm { margin: 0; padding: 0; border: 0; background: none; }

/* ---------- มือถือแนวตั้ง: ฟีดเต็มจอแบบแอป ---------- */
@media (orientation: portrait) and (max-width: 960px) {
  [data-layout="swipe"] body.sw-feedp { --deck-h: calc(100svh - 60px - env(safe-area-inset-bottom)); }
  [data-layout="swipe"] body.sw-deckp #top { display: none; }
  .sw-bg { display: none; }
  .sw-wrap { width: 100%; padding: 0; }
  .sw-stage { width: 100%; height: 100%; aspect-ratio: auto; max-width: none; border-radius: 0; }
  .sw-info { right: 74px; bottom: 16px; padding: 0 12px; }
  .sw-rail { position: absolute; z-index: 6; right: 6px; bottom: 78px; gap: 12px; padding: 0; }
  .sw-rb { font-size: .72rem; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
  .sw-rb .fa-solid { width: 42px; height: 40px; background: none; font-size: 29px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.45)); }
  .sw-rb:hover .fa-solid { background: none; }
  .sw-nav { display: none; }
  .sw-tl { gap: 4px 16px; }
  .sw-tl button { font-size: .98rem; }
  .modal-box.sw-sheet { width: 100%; max-height: 72svh; border-radius: 16px 16px 0 0; border-bottom: 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); animation: sw-up .22s ease-out; }
  #modal:has(.sw-sheet) { align-items: flex-end; padding: 0; }
  .sw-sheet .eps-grid { grid-template-columns: repeat(5, 1fr); }
}
@keyframes sw-up { from { transform: translateY(40%); opacity: .3; } }
@media (min-width: 961px), (orientation: landscape) {
  .sw-srch { display: none; }
  /* แท็บฟีดอยู่ในกรอบวิดีโอพอดี (กรอบ 9:16 สูง deck-h − 32 · กลุ่มกรอบ+ปุ่มขวาจัดกลาง → กรอบเยื้องซ้าย ~35px) */
  .sw-feedp .sw-top { left: 50%; right: auto; top: 16px; transform: translateX(calc(-50% - 35px)); width: calc((var(--deck-h) - 32px) * 9 / 16); padding: 8px 6px; }
  .sw-feedp .sw-tl { padding-left: 4px; justify-content: flex-start; }
}
/* จอเตี้ย (มือถือแนวนอน) — ปุ่มขวาเล็กลง */
@media (max-height: 540px) {
  .sw-wrap { padding: 8px 0; gap: 10px; }
  .sw-rail { gap: 6px; }
  .sw-rb .fa-solid { width: 36px; height: 36px; font-size: 16px; }
  .sw-rb span, .sw-disc { display: none; }
  .sw-av, .sw-av img { width: 38px; height: 38px; }
  .sw-d, .sw-tags { display: none; }
  .sw-nav { right: 12px; }
}
/* ธีมสว่าง: หน้าฟีดบนคอมเป็นพื้นขาว (ตัวเล่นยังดำ) */
@media (min-width: 961px) and (min-height: 541px) {
  [data-theme="cliplight"] body.sw-feedp .sw-deck { background: var(--bg); }
  [data-theme="cliplight"] body.sw-feedp .sw-bg { display: none; }
  [data-theme="cliplight"] body.sw-feedp .sw-rb { color: var(--text); }
  [data-theme="cliplight"] body.sw-feedp .sw-rb .fa-solid { background: var(--surface); }
  [data-theme="cliplight"] body.sw-feedp .sw-adsl { background: var(--surface); color: var(--text); }
  [data-theme="cliplight"] body.sw-feedp .sw-nav button { background: var(--surface); color: var(--text); }
  [data-theme="cliplight"] body.sw-feedp .sw-unmute { background: var(--text); color: var(--bg); }
}

/* ---------- หน้าเรื่อง แบบโปรไฟล์ ---------- */
.sp { max-width: 1040px; margin: 0 auto; padding-top: 28px; padding-bottom: 40px; }
.sp-head { display: flex; gap: 28px; align-items: flex-start; }
.sp-av { flex: none; width: 190px; aspect-ratio: 3 / 4; height: auto; border-radius: 12px; object-fit: cover; box-shadow: var(--shadow); background: var(--surface); }
.sp-id { min-width: 0; flex: 1; }
.sp-id h1 { margin: 0; font-size: 1.7rem; line-height: 1.25; font-weight: 700; }
.sp-at { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--text); font-weight: 600; }
.sp-at .tav { width: 26px !important; height: 26px !important; }
.sp-stats { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 14px 0 16px; color: var(--muted); }
.sp-stats b { color: var(--text); font-size: 1.12rem; margin-right: 4px; }
.sp-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-acts .btn.pri { min-width: 190px; justify-content: center; }
.sp-like { margin-top: 12px; }
.sp-desc { margin: 20px 0 8px; line-height: 1.65; white-space: pre-line; max-width: 760px; }
.sp-tags { flex-wrap: wrap; margin: 6px 0 4px; }
[data-layout="swipe"] .chip { background: var(--surface); color: var(--text); border: 0; font-weight: 600; }
[data-layout="swipe"] .chip:hover { background: var(--surface2); }
[data-layout="swipe"] .chip.on { background: var(--text); color: var(--bg); }
.sp-tabs { position: sticky; top: var(--header-h); z-index: 10; display: flex; margin: 26px 0 0; background: var(--bg); border-bottom: 1px solid var(--border); }
.sp-tabs button { flex: 0 1 220px; height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); font: inherit; font-size: 1rem; font-weight: 600; cursor: pointer; }
.sp-tabs button.on { color: var(--text); border-bottom-color: var(--text); }
[data-spp] { padding-top: 6px; }
[data-spp="cm"] .soc-cm { margin-top: 10px; }
[data-spp="sim"] .grid { margin-top: 14px; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.sp-ep { position: relative; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 6px; background: #111; color: #fff; isolation: isolate; }
.sp-ep:hover { color: #fff; }
.sp-ep img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% var(--py, 50%); transform: scale(1.3); filter: brightness(.78); transition: transform .3s, filter .3s; }
.sp-ep:hover img { transform: scale(1.38); filter: brightness(.9); }
.sp-ep::after { content: ""; position: absolute; inset: 40% 0 0; z-index: 1; background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.sp-n { position: absolute; z-index: 2; left: 8px; bottom: 26px; font-weight: 700; font-size: .95rem; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.sp-v { position: absolute; z-index: 2; left: 8px; bottom: 7px; display: flex; gap: 5px; align-items: center; font-size: .78rem; font-weight: 600; opacity: .9; }
.sp-v .fa-play { font-size: .7rem; }
.sp-lk { position: absolute; z-index: 2; top: 7px; right: 7px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,.55); }
.sp-lk .ico { width: 13px; height: 13px; font-size: 12px; }
.sp-lk:has(.fa-crown) { color: #facd00; }
.sp-now { position: absolute; z-index: 2; top: 7px; left: 7px; padding: 2px 8px; border-radius: 4px; background: var(--accent); font-size: .72rem; font-weight: 700; }
.sp-ep.seen img { filter: brightness(.45) grayscale(.3); }
.sp-ep.seen .sp-n::after { content: " · ดูแล้ว"; font-weight: 500; font-size: .75rem; opacity: .8; }
.sp-ep.na { opacity: .5; }
@media (max-width: 760px) {
  .sp { padding-top: 16px; }
  .sp-head { gap: 16px; }
  .sp-av { width: 110px; border-radius: 10px; }
  .sp-id h1 { font-size: 1.2rem; }
  .sp-stats { gap: 4px 14px; margin: 8px 0 12px; font-size: .86rem; }
  .sp-stats b { font-size: 1rem; }
  .sp-acts .btn { height: 40px; }
  .sp-acts .btn.pri { min-width: 0; flex: 1 1 100%; }
  .sp-acts [data-fav] { flex: 1; justify-content: center; }
  .sp-tabs { margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); }
  .sp-tabs button { flex: 1; font-size: .9rem; }
  .sp-grid { grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 0 calc(-1 * var(--gutter)); }
  .sp-ep { border-radius: 0; }
  .sp-n { font-size: .82rem; bottom: 22px; left: 6px; }
  .sp-v { left: 6px; font-size: .72rem; }
}

/* ---------- การ์ด (หน้าค้นหา/หมวด/ของฉัน) ---------- */
[data-layout="swipe"] .scard .poster { border-radius: 8px; box-shadow: none; }
[data-layout="swipe"] .scard .poster::after { content: ""; position: absolute; inset: 55% 0 0; background: linear-gradient(transparent, rgba(0,0,0,.6)); pointer-events: none; }
[data-layout="swipe"] .scard .eps { top: 6px; bottom: auto; }
.sc-v { position: absolute; z-index: 2; left: 8px; bottom: 7px; display: flex; align-items: center; gap: 5px; color: #fff; font-size: .8rem; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.sc-v .fa-play { font-size: .68rem; }
[data-layout="swipe"] .scard .meta .t { font-weight: 500; font-size: .92rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }
[data-layout="swipe"] .scard .meta .s { color: var(--muted); font-size: .8rem; }
[data-layout="swipe"] .page-h h1 { font-weight: 700; }
[data-layout="swipe"] .search-page .field { border-radius: 44px; background: var(--surface); border: 0; padding: 0 22px; }
[data-layout="swipe"] .sk-card { aspect-ratio: 3 / 4; }
@media (prefers-reduced-motion: reduce) { .sw-sl.sw-on:not(.sw-paused) .sw-disc, .sw-adh { animation: none; } }
