/*
Theme Name: พากย์เพลิน
Theme URI: https://example.com/pakploen
Description: ธีม "ห้องพากย์" สำหรับเว็บหนังออนไลน์พากย์ไทยเต็มเรื่อง — หัวข้อมีไทม์โค้ดการอ่าน สารบัญแบบไทม์ไลน์ คลื่นเสียงประจำหน้า คำบรรยายภาพแบบซับหนัง FAQ แบบบทพากย์ ชั้นวางม้วนฟิล์ม และเครดิตท้ายเรื่อง ทำงานคู่กับปลั๊กอิน พากย์เพลิน Core และ Rank Math
Author: พากย์เพลิน
Version: 1.0.0
Requires at least: 6.2
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: pakploen
*/

/* ------------------------------------------------------------------ tokens */
:root {
  --ink: #1d1530;
  --ink-2: #33264f;
  --ink-3: #4a3b6b;
  --paper: #f6eedc;
  --paper-2: #efe3c8;
  --card: #fffaf0;
  --text: #241a38;
  --muted: #6b5f80;
  --line: rgba(29, 21, 48, .14);
  --red: #ff4b3e;
  --red-ink: #c8281d;
  --corn: #ffc94a;
  --mint: #3fd6b0;
  --mint-ink: #0f8a6c;
  --link: #b8321f;
  --radius: 18px;
  --shadow: 0 12px 32px rgba(29, 21, 48, .12);
  --shadow-sm: 0 4px 14px rgba(29, 21, 48, .10);
  --font-body: 'Sarabun', 'Noto Sans Thai', system-ui, sans-serif;
  --font-display: 'Chonburi', 'Sarabun', serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Consolas', monospace;
  --font-hand: 'Itim', 'Sarabun', cursive;
  --wrap: 1240px;
  --prose: 720px;
  --header-h: 64px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #140f22;
  --paper-2: #1b1430;
  --card: #211939;
  --text: #ece4f7;
  --muted: #a99cc0;
  --line: rgba(236, 228, 247, .14);
  --link: #ffb2a6;
  --shadow: 0 12px 32px rgba(0, 0, 0, .45);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #140f22;
    --paper-2: #1b1430;
    --card: #211939;
    --text: #ece4f7;
    --muted: #a99cc0;
    --line: rgba(236, 228, 247, .14);
    --link: #ffb2a6;
    --shadow: 0 12px 32px rgba(0, 0, 0, .45);
    --shadow-sm: 0 4px 14px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 400 17px/1.8 var(--font-body);
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--corn); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .5em; font-weight: 700; }
p { margin: 0 0 1.1em; }
.screen-reader-text, .sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link:focus {
  position: fixed; left: 12px; top: 12px; z-index: 1000; width: auto; height: auto; clip: auto;
  padding: 10px 16px; background: var(--corn); color: var(--ink); border-radius: 10px; font-weight: 700;
}
.wrap { width: min(var(--wrap), calc(100% - 32px)); margin-inline: auto; }

/* --------------------------------------------------------------- header */
.booth {
  position: sticky; top: 0; z-index: 50;
  background: var(--ink);
  color: #f6eedc;
  box-shadow: 0 2px 0 rgba(255, 255, 255, .04), 0 10px 26px rgba(10, 6, 20, .25);
}
.booth__bar { display: flex; align-items: center; gap: 14px; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; flex-shrink: 0; }
.brand__mark { width: 40px; height: 40px; flex-shrink: 0; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name { font: 400 21px/1.1 var(--font-display); letter-spacing: .01em; }
.brand__tag { font-size: 11.5px; opacity: .7; }
.onair {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px;
  border: 1px solid rgba(255, 75, 62, .55); border-radius: 99px;
  font: 500 11px/1 var(--font-mono); letter-spacing: .12em; color: #ffd9d4; flex-shrink: 0;
}
.onair i { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: none; }
/* pulse rings animate only transform + opacity (compositor), never box-shadow: no main-thread repaint every frame */
.onair i::after, .ppl-stats__item--live i::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 50%; will-change: transform, opacity;
}
.onair i::after { background: rgba(255, 75, 62, .6); animation: pk-onair 2.4s infinite; }
@keyframes pk-onair { 0%, 60% { transform: scale(1); opacity: 1; } 100% { transform: scale(3.2); opacity: 0; } }
.tracks { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tracks::-webkit-scrollbar { display: none; }
.tracks.is-overflowing { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
.tracks ul { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; white-space: nowrap; }
.tracks a {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 99px;
  color: #f6eedc; text-decoration: none; font-size: 14.5px; background: rgba(255, 255, 255, .06);
}
.tracks a:hover, .tracks .is-current a { background: rgba(255, 201, 74, .18); color: #fff; }
.tracks small { font: 500 10.5px/1 var(--font-mono); color: var(--corn); letter-spacing: .06em; }
.booth__tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0;
  background: rgba(255, 255, 255, .07); color: #f6eedc; cursor: pointer; font-size: 18px;
}
.icon-btn:hover { background: rgba(255, 255, 255, .14); }
.playhead-bar {
  position: absolute; left: 0; bottom: -3px; height: 3px; width: 100%; background: linear-gradient(90deg, var(--mint), var(--corn), var(--red));
  transform: scaleX(var(--p, 0)); transform-origin: left; transition: transform .1s linear;
}
.search-pop { display: none; padding: 0 0 14px; }
.search-pop.is-open { display: block; }
.search-form { display: flex; gap: 8px; }
.search-form input[type="search"] {
  flex: 1; min-width: 0; padding: 11px 14px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .06); color: inherit; font: inherit;
}
main .search-form input[type="search"] { border-color: var(--line); background: var(--card); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 12px;
  border: 0; background: var(--corn); color: var(--ink); font: 700 15px/1.2 var(--font-body); text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.05); }
.btn--ghost { background: transparent; color: inherit; box-shadow: inset 0 0 0 1.5px currentColor; }

/* ---------------------------------------------------------- home: stage */
.stage {
  position: relative; color: #f6eedc; padding: 26px 0 40px;
  background:
    radial-gradient(1200px 420px at 50% -10%, rgba(255, 201, 74, .16), transparent 60%),
    radial-gradient(800px 500px at 90% 110%, rgba(63, 214, 176, .12), transparent 60%),
    linear-gradient(180deg, var(--ink) 0%, #261b40 100%);
  overflow: hidden;
}
.stage::before { /* acoustic foam texture */
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .05) 1.2px, transparent 1.3px);
  background-size: 18px 18px;
}
.slate { position: relative; max-width: 900px; margin: 0 auto 22px; text-align: center; }
.slate__clap {
  display: inline-grid; grid-template-columns: repeat(3, auto); gap: 0; margin-bottom: 12px;
  border-radius: 10px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .16);
  font: 500 12px/1 var(--font-mono); letter-spacing: .08em;
}
.slate__clap span { padding: 7px 12px; background: rgba(255, 255, 255, .05); }
.slate__clap span + span { border-left: 1px solid rgba(255, 255, 255, .14); }
.slate__clap b { color: var(--corn); font-weight: 500; }
.slate__stripes {
  display: block; height: 12px; max-width: 360px; margin: 0 auto 14px; border-radius: 4px;
  background: repeating-linear-gradient(-45deg, #f6eedc 0 14px, var(--ink) 14px 28px);
  transform: rotate(-2deg); opacity: .9;
}
.slate h1 { font: 400 clamp(26px, 4.4vw, 46px)/1.25 var(--font-display); margin: 0 0 8px; text-wrap: balance; }
.slate h1 em { font-style: normal; color: var(--corn); }
.slate__sub { margin: 0 auto; max-width: 640px; color: rgba(246, 238, 220, .78); font-size: 16px; }

.stage__grid { position: relative; display: grid; grid-template-columns: 1fr minmax(0, 640px) 1fr; gap: 26px; align-items: start; }
.monitor { position: relative; }
.monitor__bezel {
  padding: 12px; border-radius: 26px;
  background: linear-gradient(160deg, #3b2d5c, #1a1229);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 30px 60px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.monitor__label { display: flex; justify-content: space-between; margin: 10px 6px 0; font: 500 11.5px/1.4 var(--font-mono); color: rgba(246, 238, 220, .6); letter-spacing: .06em; }
.monitor__label b { color: var(--mint); font-weight: 500; }
.monitor__label:has(> a) { justify-content: center; margin-top: 2px; }
.monitor__label a { display: inline-block; padding: 8px 4px; color: inherit; text-decoration: none; }
.monitor__label a:hover { color: var(--corn); }
.monitor .lhg-game, .monitor .ppl-game { margin-bottom: 0; }
.monitor .lhg-game__note, .monitor .ppl-game__note { color: rgba(246, 238, 220, .7); }
.stage__side { padding-top: 6px; }
@media (min-width: 961px) and (max-height: 960px) {
  html:not(.ppl-seen) .monitor .ppl-game:not(.is-open) .ppl-game__box { aspect-ratio: 16 / 10; }
  html:not(.ppl-seen) .monitor .ppl-game:not(.is-open) .ppl-game__poster { object-position: 50% 45%; }
  html:not(.ppl-seen) .monitor .ppl-game:not(.is-open) .ppl-game__intro {
    flex-direction: row; align-items: flex-end; text-align: left; gap: 16px; background: linear-gradient(transparent 55%, rgba(20, 14, 40, .7));
  }
  html:not(.ppl-seen) .monitor .ppl-game:not(.is-open) .ppl-game__start { min-width: 0; flex-shrink: 0; white-space: nowrap; }
}
.side-card {
  border-radius: var(--radius); padding: 16px 16px 14px; background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .1); backdrop-filter: blur(4px);
}
.side-card + .side-card { margin-top: 14px; }
.side-card h2, .side-card__title { font: 500 12px/1.2 var(--font-mono); letter-spacing: .12em; color: var(--corn); margin: 0 0 10px; text-transform: uppercase; }
.cue-list { list-style: none; margin: 0; padding: 0; counter-reset: cue; }
.cue-list li { counter-increment: cue; }
.cue-list a { display: grid; grid-template-columns: 34px 1fr; gap: 8px; padding: 7px 0; color: #f6eedc; text-decoration: none; border-top: 1px dashed rgba(255, 255, 255, .12); font-size: 15px; line-height: 1.45; }
.cue-list li:first-child a { border-top: 0; }
.cue-list a::before { content: "Q" counter(cue, decimal-leading-zero); font: 500 11px/1.9 var(--font-mono); color: var(--mint); }
.cue-list a:hover { color: var(--corn); }
.pick { display: block; color: inherit; text-decoration: none; }
.pick img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 12px; margin-bottom: 10px; }
.pick strong { display: block; font-size: 16.5px; line-height: 1.4; }
.pick span { font-size: 14px; opacity: .75; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.stats div { text-align: center; padding: 8px 4px; border-radius: 12px; background: rgba(255, 255, 255, .05); }
.stats dt { font: 400 22px/1.1 var(--font-display); color: var(--corn); }
.stats dd { margin: 2px 0 0; font-size: 12px; opacity: .75; }

/* -------------------------------------------------------- script layout */
.script { padding: 46px 0 30px; }
.script__wrap { display: grid; grid-template-columns: 250px minmax(0, var(--prose)); gap: 56px; justify-content: center; }
.script__wrap--solo { grid-template-columns: minmax(0, var(--prose)); }
.timeline { position: sticky; top: calc(var(--header-h) + 24px); align-self: start; max-height: calc(100vh - var(--header-h) - 48px); overflow: auto; scrollbar-width: thin; }
.timeline__label { font: 500 11.5px/1.2 var(--font-mono); letter-spacing: .14em; color: var(--muted); text-transform: uppercase; margin: 0 0 12px; }
.timeline ol { position: relative; list-style: none; margin: 0; padding: 0 0 0 18px; }
.timeline ol::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.timeline__track { position: relative; }
.timeline__fill { position: absolute; z-index: 1; left: 4px; top: 6px; width: 2px; height: 0; background: linear-gradient(var(--mint), var(--red)); border-radius: 2px; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: -18px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--paper); border: 2px solid var(--line); }
.timeline li.is-past::before { border-color: var(--mint); background: var(--mint); }
.timeline li.is-active::before { border-color: var(--red); background: var(--red); box-shadow: 0 0 0 4px rgba(255, 75, 62, .18); }
.timeline a { display: block; padding: 6px 0 6px 4px; color: var(--muted); text-decoration: none; font-size: 14px; line-height: 1.45; }
.timeline a .tc::before { content: attr(data-tc); }
.timeline a .tc { display: block; font: 500 10.5px/1.4 var(--font-mono); letter-spacing: .06em; color: var(--mint-ink); }
.timeline li.is-active a { color: var(--text); font-weight: 600; }
.toc-mobile { display: none; }

/* waveform voiceprint */
.voiceprint { position: relative; display: block; margin: 0 0 26px; }
.voiceprint svg { display: block; width: 100%; height: 54px; }
.voiceprint use { fill: var(--line); }
.voiceprint .vp-played use { fill: var(--mint); }
.voiceprint__meta { display: flex; justify-content: space-between; font: 500 11px/1.6 var(--font-mono); color: var(--muted); letter-spacing: .05em; }

/* ---------------------------------------------------------------- prose */
.prose { font-size: 18px; line-height: 1.9; min-width: 0; }
.prose > * { max-width: 100%; }
.prose h2 { position: relative; font: 700 clamp(23px, 2.6vw, 29px)/1.4 var(--font-body); margin: 2.1em 0 .6em; padding-top: 4px; scroll-margin-top: calc(var(--header-h) + 18px); }
/* timecode chip painted from data-tc, so the heading text itself stays clean for search engines */
.prose h2[data-tc]::before {
  content: attr(data-tc); display: table; margin: 0 0 6px; padding: 3px 9px 3px 22px; border-radius: 6px;
  background: radial-gradient(circle at 12px 50%, var(--red) 3.5px, transparent 4px), var(--ink);
  color: var(--corn); font: 500 11.5px/1.3 var(--font-mono); letter-spacing: .08em;
}
.prose h3 { font-size: 20.5px; margin: 1.6em 0 .5em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.3em; }
.prose li { margin: .3em 0; }
.prose ul li::marker { content: "▸  "; color: var(--red); }
.prose ol li::marker { font: 500 .85em var(--font-mono); color: var(--mint-ink); }
.prose strong { color: inherit; font-weight: 700; background: linear-gradient(transparent 62%, rgba(255, 201, 74, .45) 62%); }
.prose blockquote {
  position: relative; margin: 1.6em 0; padding: 18px 22px 18px 26px; border-radius: 4px 18px 18px 4px;
  background: #fff3c4; color: #3b2a12; font: 400 19px/1.75 var(--font-hand); transform: rotate(-.6deg);
  box-shadow: var(--shadow-sm); border-left: 5px solid var(--corn);
}
:root[data-theme="dark"] .prose blockquote { background: #3a3016; color: #fbecc0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .prose blockquote { background: #3a3016; color: #fbecc0; } }
.prose blockquote p:last-child { margin: 0; }
.prose blockquote::before { content: "โน้ตจากห้องพากย์"; display: block; font: 500 11px/1.4 var(--font-mono); letter-spacing: .1em; color: #a06b00; margin-bottom: 4px; }
.prose table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 1.4em 0 1.8em; font-size: 15.5px; line-height: 1.6; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.prose thead th { background: var(--ink); color: #f6eedc; font-weight: 600; white-space: nowrap; }
.prose tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--paper-2) 60%, transparent); }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose a { color: var(--link); }
.table-scroll { margin: 1.4em 0 1.8em; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.prose .table-scroll table { display: table; width: 100%; margin: 0; border: 0; border-radius: 0; overflow: visible; }

/* lead = first cue card */
.ppl-lead {
  position: relative; margin: 0 0 28px; padding: 22px 24px 8px; border-radius: 6px 22px 22px 22px;
  background: var(--card); box-shadow: var(--shadow); font-size: 19.5px; line-height: 1.85;
  border: 1px solid var(--line);
}
.ppl-lead::before {
  content: "CUE 01 · คำตอบสั้น"; position: absolute; left: -1px; top: -26px; padding: 4px 12px 5px; border-radius: 10px 10px 0 0;
  background: var(--red); color: #fff; font: 500 11.5px/1.4 var(--font-mono); letter-spacing: .08em;
}

/* storyboard shots with movie-subtitle captions */
.prose { counter-reset: shot; }
.ppl-shot { position: relative; margin: 30px 0; counter-increment: shot; }
.ppl-shot img { display: block; width: 100%; height: auto; border-radius: 16px; box-shadow: var(--shadow); background: var(--paper-2); }
.ppl-shot::before {
  content: "SHOT " counter(shot, decimal-leading-zero); position: absolute; z-index: 2; left: 14px; top: 12px; padding: 3px 9px; border-radius: 6px;
  background: rgba(20, 14, 34, .72); color: #f6eedc; font: 500 11px/1.4 var(--font-mono); letter-spacing: .1em;
}
.ppl-shot figcaption {
  margin: 10px 4px 0; font-size: 15px; color: var(--muted); text-align: center;
}
.ppl-shot--sub figcaption, .is-guide .ppl-shot figcaption {
  position: absolute; left: 6%; right: 6%; bottom: 7%; margin: 0; color: #ffe27a; font-weight: 700; font-size: clamp(15px, 2vw, 21px); line-height: 1.5;
  text-shadow: 0 0 2px #000, 0 0 2px #000, 0 2px 3px #000, 0 0 8px rgba(0, 0, 0, .8);
}
.ppl-shot--sub figcaption::before, .is-guide .ppl-shot figcaption::before { content: "[ซับไทย] "; font: 500 .62em var(--font-mono); color: #fff; opacity: .85; vertical-align: middle; }
@media (min-width: 900px) {
  .ppl-shot--left { float: left; width: 46%; margin: 8px 28px 16px 0; transform: rotate(-1.4deg); }
  .ppl-shot--right { float: right; width: 46%; margin: 8px 0 16px 28px; transform: rotate(1.4deg); }
  .ppl-shot--left img, .ppl-shot--right img { border: 8px solid #fff; border-bottom-width: 34px; border-radius: 4px; }
  .ppl-shot--left figcaption, .ppl-shot--right figcaption { position: absolute; bottom: 4px; left: 0; right: 0; margin: 0; font: 400 15px/1.3 var(--font-hand); color: #5b4c70; }
}
.prose h2 { clear: both; }

/* FAQ as a dubbing script */
.ppl-faq {
  clear: both; margin: 2.6em 0 1em; padding: 26px 24px 10px 64px; border-radius: 18px; position: relative;
  background:
    linear-gradient(90deg, transparent 46px, rgba(255, 75, 62, .35) 46px 47px, transparent 47px),
    repeating-linear-gradient(transparent 0 33px, var(--line) 33px 34px),
    var(--card);
  box-shadow: var(--shadow-sm); border: 1px solid var(--line); counter-reset: line;
}
.ppl-faq h2 { margin: 0 0 18px -40px; font-size: 22px; }
.ppl-faq h2[data-tc]::before { content: none; }
.ppl-faq h3, .ppl-faq p { position: relative; counter-increment: line; }
.ppl-faq h3::after, .ppl-faq p::after {
  content: counter(line, decimal-leading-zero); position: absolute; left: -54px; top: .35em; font: 500 11px/1 var(--font-mono); color: var(--muted);
}
.ppl-faq h3 { margin: 18px 0 4px; font-size: 18px; }
.ppl-faq h3::before { content: "ผู้ชม"; display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: 6px; background: var(--ink); color: var(--corn); font: 500 11.5px/1.7 var(--font-mono); vertical-align: 2px; }
.ppl-faq p::before { content: "พากย์เพลิน"; display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: 6px; background: var(--mint); color: #08392c; font: 500 11.5px/1.7 var(--font-mono); vertical-align: 2px; }

/* ----------------------------------------------------- guide page header */
.crumbs { padding: 18px 0 0; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.crumbs li + li::before { content: "›"; margin-right: 6px; opacity: .6; }
.cue-head { padding: 18px 0 6px; }
.cue-head__reel { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; font: 500 12px/1.4 var(--font-mono); letter-spacing: .06em; color: var(--muted); }
.cue-head__reel a { padding: 4px 10px; border-radius: 99px; background: var(--ink); color: var(--corn); text-decoration: none; }
.cue-head h1 { font: 400 clamp(28px, 4.2vw, 46px)/1.3 var(--font-display); max-width: 980px; margin: 0 0 12px; text-wrap: balance; }
.cue-head__meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; color: var(--muted); font-size: 14.5px; }
.cue-head__meta span::before { content: "●"; margin-right: 6px; font-size: 8px; vertical-align: 2px; color: var(--mint-ink); }

/* -------------------------------------------------------- tickets/shelves */
.shelves { padding: 30px 0 60px; background: linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%); }
.shelves__head { text-align: center; margin: 0 auto 26px; max-width: 760px; }
.shelves__head h2 { font: 400 clamp(26px, 3.4vw, 38px)/1.3 var(--font-display); margin: 0 0 6px; }
.shelves__head p { color: var(--muted); margin: 0; }
.reel { margin: 0 0 34px; }
.shelves .reel { content-visibility: auto; contain-intrinsic-size: auto 480px; }
.reel__head { display: flex; align-items: end; gap: 14px; margin-bottom: 12px; }
.reel__no { font: 400 46px/0.9 var(--font-display); color: var(--red); }
.reel__title { flex: 1; min-width: 0; }
.reel__title h3 { margin: 0; font-size: 22px; }
.reel__title p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.reel__all { flex-shrink: 0; font-size: 14.5px; font-weight: 600; }
.reel__strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 270px); gap: 14px; overflow-x: auto;
  padding: 6px 4px 16px; scroll-snap-type: x proximity; scrollbar-width: thin; overscroll-behavior-x: contain;
}
.ticket {
  position: relative; display: flex; flex-direction: column; scroll-snap-align: start; border-radius: 16px; overflow: hidden;
  background: var(--card); color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm); border: 1px solid var(--line);
  transition: transform .18s ease, box-shadow .18s ease;
}
.ticket:hover { transform: translateY(-3px) rotate(-.4deg); box-shadow: var(--shadow); }
.ticket img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.ticket__body { position: relative; padding: 14px 16px 16px; border-top: 2px dashed var(--line); flex: 1; }
.ticket__body::before, .ticket__body::after { /* punched holes */
  content: ""; position: absolute; top: -10px; width: 18px; height: 18px; border-radius: 50%; background: var(--paper-2);
}
.ticket__body::before { left: -10px; }
.ticket__body::after { right: -10px; }
.ticket__no { font: 500 10.5px/1 var(--font-mono); letter-spacing: .1em; color: var(--mint-ink); }
.ticket strong { display: block; margin: 6px 0 4px; font-size: 17.5px; line-height: 1.4; }
.ticket span.ex { display: block; font-size: 14px; line-height: 1.55; color: var(--muted); }

/* next up (guide pages) */
.next-up { padding: 30px 0 50px; }
.next-up__grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr); gap: 22px; align-items: stretch; }
.episode {
  position: relative; display: flex; flex-direction: column; justify-content: end; min-height: 260px; padding: 22px; border-radius: 22px; overflow: hidden;
  color: #fff; text-decoration: none; background: var(--ink); isolation: isolate;
}
.episode img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; opacity: .75; }
.episode::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(20, 14, 34, 0) 20%, rgba(20, 14, 34, .92) 100%); }
.episode__label { font: 500 12px/1.4 var(--font-mono); letter-spacing: .12em; color: var(--corn); }
.episode strong { font: 400 24px/1.35 var(--font-display); margin: 6px 0; }
.episode__count { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; opacity: .9; }
.episode__ring { width: 26px; height: 26px; }
.related { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.related .ticket { position: relative; flex-direction: row; padding-left: 38%; min-height: 120px; }
.related .ticket img {
  position: absolute; left: 0; top: 0; width: 38%; height: 100%; min-height: 0; aspect-ratio: auto; object-fit: cover;
  contain-intrinsic-size: none; /* cancels core's 3000x1500 placeholder for lazy sizes=auto images */
}
.related .ticket__body { border-top: 0; border-left: 2px dashed var(--line); }
.related .ticket__body::before { top: -10px; left: -10px; }
.related .ticket__body::after { top: auto; bottom: -10px; left: -10px; right: auto; }
.section-title { font: 400 26px/1.3 var(--font-display); margin: 0 0 16px; }

/* library (hub page) */
.ppl-library__reel { margin: 0 0 2em; }
.ppl-library__blurb { color: var(--muted); }
.ppl-library__list { list-style: none !important; padding: 0 !important; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ppl-library__list li::marker { content: "" !important; }
.ppl-library__list a { display: block; height: 100%; padding: 12px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--text); line-height: 1.5; }
.ppl-library__list a:hover { border-color: var(--red); }
.ppl-library__list strong { display: block; background: none; color: var(--link); }
.ppl-library__list span { font-size: 14.5px; color: var(--muted); }

/* game call-to-action pill on inner pages */
.game-pill {
  position: fixed; right: 16px; bottom: 16px; z-index: 40; display: flex; align-items: center; padding: 0 5px 0 0;
  border-radius: 99px; background: var(--ink); color: #f6eedc; box-shadow: 0 10px 26px rgba(10, 6, 20, .35); font-size: 14.5px;
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
}
.game-pill__link { display: flex; align-items: center; gap: 10px; padding: 8px 4px 8px 8px; border-radius: 99px; color: inherit; text-decoration: none; }
.game-pill__lead { font-style: normal; }
.game-pill img { width: 38px; height: 38px; border-radius: 50%; background: #3b2a66; object-fit: cover; }
.game-pill b { color: var(--corn); }
.game-pill__x {
  flex-shrink: 0; width: 44px; height: 44px; padding: 9px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .1);
  background-clip: content-box; color: inherit; font: 400 16px/1 var(--font-body); cursor: pointer;
}
.game-pill__x:hover { background-color: rgba(255, 255, 255, .2); }
.pk-js .game-pill.pk-pill-wait { opacity: 0; visibility: hidden; transform: translateY(12px); }
.game-pill.is-hidden { display: none; }

/* ------------------------------------------------------- footer credits */
.credits { background: var(--ink); color: #e9e0f5; padding: 56px 0 30px; text-align: center; }
body:not(.home) .credits { padding-bottom: 92px; } /* room for the floating game pill */
.credits__end { font: 400 clamp(30px, 4.6vw, 52px)/1.2 var(--font-display); margin: 0 0 4px; color: #fff; }
.credits__thanks { margin: 0 0 34px; color: rgba(233, 224, 245, .7); }
.credits__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px 40px; text-align: center; max-width: 1040px; margin: 0 auto 34px; }
.credits__grid { content-visibility: auto; contain-intrinsic-size: auto 540px; }
.credits__role { font: 500 11.5px/1.4 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--corn); margin: 0 0 8px; }
.credits ul { list-style: none; margin: 0; padding: 0; }
.credits li { margin: 2px 0; }
.credits a { color: #e9e0f5; text-decoration: none; font-size: 15px; }
.credits a:hover { color: var(--corn); text-decoration: underline; }
.credits__note { max-width: 760px; margin: 0 auto 16px; font-size: 13.5px; line-height: 1.7; color: rgba(233, 224, 245, .74); }
.credits__copy { font: 500 11.5px/1.6 var(--font-mono); letter-spacing: .06em; color: rgba(233, 224, 245, .68); }

/* --------------------------------------------------------- misc pages */
.page-simple { padding: 30px 0 60px; }
.archive-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; padding: 0; list-style: none; }
.notfound { text-align: center; padding: 70px 0 80px; }
.notfound__code { font: 400 clamp(70px, 14vw, 150px)/1 var(--font-display); color: var(--red); margin: 0; }
.pagination { display: flex; gap: 8px; justify-content: center; margin: 30px 0; }
.pagination .page-numbers { padding: 6px 12px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); text-decoration: none; }
.pagination .current { background: var(--ink); color: #fff; }

/* -------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .stage__grid { grid-template-columns: minmax(0, 640px); justify-content: center; }
  .stage__side { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .stage__side .side-card + .side-card { margin-top: 0; }
  .stage__side--l { order: 2; }
  .stage__side--r { order: 3; }
  .script__wrap { grid-template-columns: 210px minmax(0, var(--prose)); gap: 36px; }
}
@media (max-width: 960px) {
  .script__wrap { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .timeline { display: none; }
  .onair { display: none; }
  .tracks small { display: none; }
  .toc-mobile { display: block; margin: 0 0 34px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
  .toc-mobile summary { cursor: pointer; padding: 12px 16px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; }
  .toc-mobile summary::after { content: "▾"; }
  .toc-mobile[open] summary::after { content: "▴"; }
  .toc-mobile ol { margin: 0; padding: 0 16px 12px 16px; list-style: none; }
  .toc-mobile a { display: flex; gap: 10px; padding: 6px 0; text-decoration: none; color: var(--text); border-top: 1px dashed var(--line); font-size: 15px; line-height: 1.5; }
  .toc-mobile .tc { font: 500 11px/1.9 var(--font-mono); color: var(--mint-ink); flex-shrink: 0; }
  .toc-mobile .tc::before { content: attr(data-tc); }
  .next-up__grid { grid-template-columns: 1fr; }
  .credits__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); contain-intrinsic-size: auto 820px; }
}
@media (max-width: 680px) {
  body { font-size: 16.5px; }
  :root { --header-h: 102px; } /* two-row header: brand + tools, then all five tracks */
  .brand__tag { display: none; }
  .brand__name { font-size: 18px; }
  .onair { display: none; }
  .booth__bar { flex-wrap: wrap; height: auto; column-gap: 10px; row-gap: 0; padding-top: 8px; }
  .booth__tools { margin-left: auto; }
  .tracks { order: 3; flex: 0 0 100%; padding: 6px 0 8px; }
  .tracks ul { gap: 5px; }
  .tracks a { padding: 6px 8px; min-height: 36px; font-size: 13.5px; }
  .tracks small { display: none; }
  .icon-btn { width: 44px; height: 44px; }
  .cue-head__reel a { padding: 9px 12px; }
  .ppl-stats__badge { min-height: 44px; }
  .toc-mobile a { padding: 10px 0; }
  .crumbs a { display: inline-block; padding: 10px 0; }
  .prose thead th { white-space: normal; }
  .prose th, .prose td { padding: 10px 11px; }
  .ppl-shot--sub figcaption::before, .is-guide .ppl-shot figcaption::before { font-size: 11px; }
  .ticket__no { font-size: 11.5px; }
  .credits__role, .credits__copy { font-size: 12px; }
  .reel__head { flex-wrap: wrap; align-items: center; column-gap: 12px; row-gap: 0; }
  .reel__title { flex: 1 1 0; min-width: 0; }
  .reel__all { order: 3; flex: 0 0 100%; text-align: right; padding: 9px 0; }
  .stage { padding: 12px 0 28px; } /* tighter slate: the play button stays on the first phone screen under the 2-row header */
  .slate { margin-bottom: 14px; }
  .slate__stripes { height: 10px; margin-bottom: 10px; }
  .slate__clap { margin-bottom: 8px; }
  .slate__clap span { padding: 6px 8px; font-size: 10.5px; }
  .slate h1 { margin-bottom: 6px; }
  .slate__sub { font-size: 14.5px; line-height: 1.65; }
  .monitor__bezel { padding: 8px; border-radius: 20px; }
  .stage__side { grid-template-columns: 1fr; }
  .prose { font-size: 17px; line-height: 1.85; }
  .ppl-lead { font-size: 17.5px; padding: 18px 18px 6px; }
  .ppl-faq { padding: 22px 16px 6px 20px; background: var(--card); }
  .ppl-faq h2 { margin-left: 0; }
  .ppl-faq h3::after, .ppl-faq p::after { display: none; }
  .related { grid-template-columns: 1fr; }
  .reel__no { font-size: 34px; }
  .reel__strip { grid-auto-columns: 78%; }
  .credits__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 12px; contain-intrinsic-size: auto 810px; }
  .credits a { display: inline-block; padding: 5px 2px; line-height: 1.35; }
  .ppl-library__list { grid-template-columns: 1fr; }
  .game-pill__lead { display: none; }
  .game-pill b { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .booth, .stage, .timeline, .shelves, .next-up, .credits, .game-pill { display: none !important; }
}

/* ------------------------------------------------- visitor counter (footer) */
.ppl-stats { position: relative; display: flex; justify-content: center; margin: 0 0 14px; }
.ppl-stats__badge {
  display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 12px; padding: 5px 12px 5px 5px;
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 10px; background: rgba(0, 0, 0, .22); color: rgba(233, 224, 245, .8);
  font: 400 12.5px/1.4 var(--font-body); cursor: pointer;
}
.ppl-stats__badge:hover { border-color: rgba(255, 201, 74, .5); }
.ppl-stats__logo { padding: 3px 6px; border-radius: 6px; background: var(--corn); color: var(--ink); font: 500 10px/1.2 var(--font-mono); letter-spacing: .1em; }
.ppl-stats__item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.ppl-stats__item--live i { position: relative; width: 7px; height: 7px; border-radius: 50%; background: #34e08f; box-shadow: 0 0 0 3px rgba(52, 224, 143, .2); animation: none; }
.ppl-stats__item--live i::after { box-shadow: 0 0 0 3px rgba(52, 224, 143, .45); animation: pk-ring 2s infinite; }
@keyframes pk-ring { 50% { transform: scale(1.8); opacity: 0; } }
.ppl-stats__num {
  display: inline-block; min-width: 2.2em; padding: 1px 5px; border-radius: 4px; background: #0d0918; color: #7dffc4;
  font: 500 12px/1.4 var(--font-mono); letter-spacing: .04em; text-align: center; font-variant-numeric: tabular-nums;
}
.ppl-stats__panel {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 5; width: min(340px, calc(100vw - 32px));
  padding: 14px 14px 10px; border-radius: 14px; background: #120c20; border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .5); text-align: left; color: #e9e0f5;
}
.ppl-stats__panel table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ppl-stats__panel th, .ppl-stats__panel td { padding: 5px 4px; border-bottom: 1px dashed rgba(255, 255, 255, .1); text-align: right; font-weight: 400; }
.ppl-stats__panel th:first-child, .ppl-stats__panel tbody th { text-align: left; color: rgba(233, 224, 245, .78); }
.ppl-stats__panel thead th { font: 500 10.5px/1.3 var(--font-mono); letter-spacing: .08em; color: var(--corn); }
.ppl-stats__chart-title { margin: 12px 0 6px; font: 500 10.5px/1.3 var(--font-mono); letter-spacing: .08em; color: var(--corn); }
.ppl-stats__chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 92px; margin: 0; padding: 0; list-style: none; align-items: end; }
.ppl-stats__chart li { display: flex; flex-direction: column; align-items: center; justify-content: end; height: 100%; font-size: 10.5px; line-height: 1.2; }
.ppl-stats__bar { display: block; width: 70%; min-height: 3px; border-radius: 4px 4px 1px 1px; background: linear-gradient(var(--corn), var(--mint)); }
.ppl-stats__chart b { margin-top: 3px; font: 500 10px/1.2 var(--font-mono); color: #7dffc4; }
.ppl-stats__chart small { color: rgba(233, 224, 245, .7); }
.ppl-stats__note { margin: 8px 0 0; font-size: 11.5px; color: rgba(233, 224, 245, .68); }
@media (max-width: 680px) {
  .ppl-stats__badge { gap: 4px 9px; }
  .ppl-stats__logo { font-size: 11.5px; }
}
