/*
Theme Name: sd-b4 石板儀表
Theme URI: https://example.invalid/
Author: SD Network
Description: 石板儀表風短劇主題：石板灰底配青綠數據色，卡片帶集數與時長小儀表條，列表頁右側固定篩選欄。
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 8.1
Text Domain: sd-b4
*/

/* ==========================================================================
   共用基礎層（結構 / 行為）— 顏色與造型一律走變數，各主題在下方覆寫
   需要的變數：--bg --surface --ink --muted --line --accent --accent-2 --accent-soft
              --on-accent --radius --wrap --gut --font --scrim
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.7 var(--font); overflow-x: clip;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body.sd-no-scroll { overflow: hidden; }
img, video, iframe, svg { max-width: 100%; }
img { height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.b4-wrap { width: 100%; max-width: var(--wrap, 1240px); margin: 0 auto; padding: 0 var(--gut, 20px); }
.sr-only, .screen-reader-text {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 12px; top: -80px; z-index: 999; padding: 12px 18px; background: var(--ink); color: var(--bg); }
.skip:focus { top: 12px; }

/* ---------- 搜尋表單 ---------- */
.b4-sf { display: flex; gap: 8px; align-items: stretch; }
.b4-sf input[type="search"] {
  flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--radius);
  -webkit-appearance: none; appearance: none;
}
.b4-sf input[type="search"]::placeholder { color: var(--muted); opacity: .8; }
.b4-sf button {
  flex: 0 0 auto; min-height: 44px; padding: 0 20px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent); font-weight: 700;
}

/* ---------- 搜尋面板 / 遮罩 / 手機抽屜（app.js 以 id 綁定） ---------- */
.b4-search {
  position: fixed; inset: 0; z-index: 200; display: grid; align-items: start; justify-items: center;
  padding: 12vh 16px 16px; background: var(--scrim, rgba(0, 0, 0, .55));
  opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
}
.b4-search.is-open { opacity: 1; visibility: visible; }
.b4-search__box {
  width: min(640px, 100%); max-height: 80vh; overflow: auto; padding: 20px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius);
}
.b4-search__hint { margin: 18px 0 8px; font-size: 13px; color: var(--muted); }
.b4-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.b4-tags a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 14px;
}
.b4-tags a:hover { border-color: var(--accent); color: var(--accent); }

.b4-overlay { position: fixed; inset: 0; z-index: 150; background: var(--scrim, rgba(0, 0, 0, .55)); opacity: 0; transition: opacity .25s; }
.b4-overlay.is-open { opacity: 1; }
.b4-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 160; width: min(320px, 86vw);
  padding: 68px 22px 28px; overflow: auto; background: var(--surface); color: var(--ink);
  border-left: 1px solid var(--line);
  transform: translateX(100%); visibility: hidden; transition: transform .25s, visibility .25s;
}
.b4-drawer.is-open { transform: none; visibility: visible; }
.b4-drawer__close {
  position: absolute; top: 10px; right: 10px; width: 48px; height: 48px;
  display: grid; place-items: center; border: 0; background: transparent; font-size: 20px;
}
.b4-drawer__list { list-style: none; margin: 0; padding: 0; }
.b4-drawer__list a { display: flex; align-items: center; min-height: 52px; border-bottom: 1px solid var(--line); font-size: 17px; }
.b4-drawer__list [aria-current="page"], .b4-drawer__list .current-menu-item > a { color: var(--accent); font-weight: 700; }

/* ---------- 麵包屑 ---------- */
.sd-crumbs { padding: 14px 0 4px; font-size: 13px; color: var(--muted); }
.sd-crumbs__list { display: flex; flex-wrap: wrap; align-items: center; list-style: none; margin: 0; padding: 0; }
.sd-crumbs li { display: inline-flex; align-items: center; min-width: 0; }
.sd-crumbs li + li::before { content: "/"; margin: 0 8px; opacity: .5; }
.sd-crumbs a { display: inline-flex; align-items: center; min-height: 44px; }
.sd-crumbs a:hover { color: var(--accent); }
.sd-crumbs [aria-current="page"] { color: var(--ink); max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 分頁 ---------- */
.sd-pagination { margin: 36px 0 8px; }
.sd-pagination .nav-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.sd-pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 600;
}
.sd-pagination a.page-numbers:hover { border-color: var(--accent); color: var(--accent); }
.sd-pagination .current { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.sd-pagination .dots { background: none; border-color: transparent; }

/* ---------- 播放器 / 提示框 ---------- */
.sd-player { background: #000; overflow: hidden; }
.sd-player video { display: block; width: 100%; aspect-ratio: 9 / 16; max-height: 78vh; object-fit: contain; background: #000; }
.sd-embed { aspect-ratio: 9 / 16; max-height: 78vh; background: #000; }
.sd-embed iframe { display: block; width: 100%; height: 100%; border: 0; }
.sd-player__fallback { padding: 18px; color: #e5e7eb; font-size: 14px; }
.sd-player__fallback a { text-decoration: underline; }
.sd-callout { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 20px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.sd-callout__body { flex: 1 1 200px; }
.sd-callout__title { font-weight: 800; margin-bottom: 4px; }
.sd-callout__desc { color: var(--muted); font-size: 14px; }
.sd-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 22px;
  border: 0; border-radius: var(--radius); background: var(--accent); color: var(--on-accent); font-weight: 700;
}

/* ---------- 版面骨架（詳情 / 分集）：左播放器、右選集；≤900px 上下堆疊 ---------- */
.b4-dgrid { display: grid; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); gap: 32px; align-items: start; }
.b4-dgrid__l, .b4-dgrid__r { min-width: 0; }
.b4-dposter img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }
.b4-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.b4-pill { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; font-size: 13px; border: 1px solid var(--line); border-radius: 999px; }
a.b4-pill { min-height: 44px; }
.b4-pill--accent { border-color: var(--accent); color: var(--accent); }
.b4-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; }
.b4-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 22px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--radius); font-weight: 600;
}
.b4-btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.b4-note { padding: 14px 16px; border: 1px dashed var(--line); color: var(--muted); font-size: 14px; }
.b4-pn { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.b4-pn a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface); }
.b4-pn a.is-next { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.b4-side-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: 16px; color: var(--accent); font-weight: 600; }
.b4-prose { max-width: 70ch; }
.b4-prose img { height: auto; }
.b4-faq details { border-bottom: 1px solid var(--line); }
.b4-faq summary { display: flex; align-items: center; min-height: 52px; cursor: pointer; font-weight: 600; }
.b4-faq details p { color: var(--muted); }
.b4-empty, .b4-notfound { padding: 48px 0; }
.b4-notfound__search { max-width: 520px; margin: 22px 0; }
.b4-notfound__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.b4-results { display: grid; gap: 0; }
.b4-result { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); align-items: flex-start; min-width: 0; }
.b4-result__img { width: 72px; flex: 0 0 72px; aspect-ratio: 2 / 3; object-fit: cover; }
.b4-result__body { display: grid; gap: 4px; min-width: 0; }
.b4-result__t { font-weight: 700; overflow-wrap: anywhere; }
.b4-result__m, .b4-result__x { font-size: 13px; color: var(--muted); }
.b4-searchbar { max-width: 640px; margin: 4px 0 24px; }

/* ---------- 篩選條：行內捲動，不撐破版面 ---------- */
.b4-filter { display: grid; gap: 4px; margin: 0 0 24px; }
.b4-filter__row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.b4-filter__label { flex: 0 0 auto; font-size: 13px; color: var(--muted); }
.b4-filter__list { display: flex; flex: 1 1 auto; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.b4-filter__list::-webkit-scrollbar { display: none; }
.b4-filter__list a { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; white-space: nowrap; }

/* ---------- 選集容器（app.js 會把目前集捲到可視範圍） ---------- */
[data-eps] { position: relative; }

/* ---------- 共用預設（各主題在 theme.css 覆寫） ---------- */
.b4-block { margin-top: clamp(40px, 6vw, 72px); }
.b4-pagehead { padding: 26px 0 20px; }
.b4-pagehead h1 { font-size: clamp(28px, 4vw, 44px); overflow-wrap: anywhere; }
.b4-pagehead p { margin: 10px 0 0; color: var(--muted); }
.b4-dhead { padding: 8px 0 22px; }
.b4-dhead h1 { font-size: clamp(26px, 3.6vw, 40px); overflow-wrap: anywhere; }
.b4-syn { font-size: 16px; line-height: 1.9; }
.b4-h2 { font-size: 20px; margin: 0 0 14px; }
.b4-h2 small { margin-left: 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.b4-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); column-gap: 28px; margin: 0; }
.b4-fact { padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.b4-fact dt { font-size: 12.5px; color: var(--muted); }
.b4-fact dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.b4-fact--wide { grid-column: 1 / -1; }
.b4-article { max-width: 860px; }
.b4-notfound__code { margin: 0; font-size: clamp(72px, 16vw, 150px); font-weight: 900; line-height: 1; color: var(--accent); }
.b4-notfound h1 { font-size: clamp(26px, 4vw, 40px); margin: 6px 0 10px; }
.b4-notfound__desc { max-width: 34em; color: var(--muted); }
.b4-empty__title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.b4-result:hover .b4-result__t { color: var(--accent); }
.b4-sec { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.b4-sec__more { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); font-weight: 600; white-space: nowrap; }

@media (max-width: 900px) {
  .b4-dgrid { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .b4-dgrid__l .sd-player, .b4-dgrid__l .b4-dposter { max-width: 420px; margin-inline: auto; }
}
@media (max-width: 560px) {
  :root { --gut: 16px; }
  .b4-filter__row { gap: 8px; }
  .sd-crumbs [aria-current="page"] { max-width: 48vw; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ==========================================================================
   sd-b4 石板儀表：淺石板灰方格底 / 深石板頂欄 / 青綠數據色 / 等寬數字 / 集數·時長儀表條 / 右側固定篩選欄
   ========================================================================== */

:root {
  --bg: #dde3e6;
  --surface: #f4f6f7;
  --panel: #ffffff;
  --ink: #1f2a30;
  --muted: #5d6d76;
  --line: #c6cfd4;
  --accent: #0f9e8e;
  --accent-2: #2dd4bf;
  --accent-soft: rgba(15, 158, 142, .14);
  --on-accent: #ffffff;
  --slate: #2b363d;
  --slate-dk: #1f282e;
  --radius: 6px;
  --wrap: 1320px;
  --gut: 24px;
  --scrim: rgba(31, 40, 46, .6);
  --sans: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font: var(--sans);
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Courier New", monospace;
}

body {
  background-color: var(--bg);
  background-image: linear-gradient(rgba(43, 54, 61, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(43, 54, 61, .06) 1px, transparent 1px);
  background-size: 28px 28px;
}
h1, h2, h3 { font-weight: 800; }
a:hover { color: var(--accent); }
.b4-main { overflow-x: clip; }

/* ---------- 頁首 ---------- */
.b4-head { position: sticky; top: 0; z-index: 100; background: var(--slate); color: #e9f0f2; box-shadow: 0 2px 0 rgba(0, 0, 0, .2); }
.b4-head__in { display: flex; align-items: center; gap: 26px; min-height: 62px; }
.b4-brand { display: inline-flex; align-items: center; gap: 12px; min-height: 48px; font-size: 19px; font-weight: 800; letter-spacing: .06em; color: #fff; }
.b4-brand:hover { color: var(--accent-2); }
.b4-brand__mark { display: inline-flex; align-items: flex-end; gap: 3px; height: 22px; }
.b4-brand__mark i { display: block; width: 5px; background: var(--accent-2); border-radius: 1px; }
.b4-brand__mark i:nth-child(1) { height: 10px; }
.b4-brand__mark i:nth-child(2) { height: 22px; }
.b4-brand__mark i:nth-child(3) { height: 15px; }
.b4-brand__img { max-height: 36px; width: auto; }
.b4-nav { flex: 1 1 auto; min-width: 0; }
.b4-nav__list { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.b4-nav__list a { display: flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: var(--radius); font-size: 14.5px; font-weight: 600; color: #b9c7cd; }
.b4-nav__list a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.b4-nav__list [aria-current="page"], .b4-nav__list .current-menu-item > a { background: var(--accent); color: #fff; }
.b4-tools { display: flex; gap: 4px; margin-left: auto; }
.b4-tool { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 0 14px; border: 1px solid rgba(255, 255, 255, .22); background: transparent; color: #e9f0f2; border-radius: var(--radius); font-size: 14px; }
.b4-tool:hover { border-color: var(--accent-2); color: var(--accent-2); }
.b4-tool--menu { display: none; justify-content: center; padding: 0; }
.b4-status { background: var(--slate-dk); color: #8fa3ad; font: 12px var(--mono); }
.b4-status__in { display: flex; align-items: center; gap: 10px; min-height: 34px; overflow: hidden; white-space: nowrap; }
.b4-status__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 3px rgba(45, 212, 191, .25); flex: 0 0 auto; }
.b4-status__sep { opacity: .5; }
.b4-status__tag { margin-left: auto; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 儀表條 ---------- */
.b4-meter { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 3px 8px; min-width: 0; }
.b4-meter__k { font: 11.5px var(--mono); color: var(--muted); letter-spacing: .04em; }
.b4-meter__v { font: 700 13px var(--mono); text-align: right; color: var(--ink); }
.b4-meter__bar { grid-column: 1 / -1; position: relative; display: block; height: 6px; border-radius: 3px; background: #d5dde1; overflow: hidden; }
.b4-meter__bar i { display: block; width: var(--p, 0%); height: 100%; background: var(--accent); }
.b4-meter__bar::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 7px, rgba(255, 255, 255, .85) 7px 8px); }
.b4-meter--dur .b4-meter__bar i { background: #5f7f91; }

/* ---------- 區塊 / 按鈕 ---------- */
.b4-sec { margin: 0 0 18px; padding-bottom: 10px; border-bottom: 2px solid var(--slate); align-items: center; }
.b4-sec h2 { display: flex; align-items: center; gap: 10px; font-size: clamp(18px, 2vw, 22px); }
.b4-sec h2 i { display: block; width: 10px; height: 10px; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.b4-sec__more { font: 600 13px var(--mono); }
.b4-block { margin-top: clamp(36px, 5vw, 60px); }
.b4-btn { background: var(--panel); border-color: var(--line); font-weight: 700; }
.b4-btn:hover { border-color: var(--accent); color: var(--accent); }
.b4-btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.b4-btn--primary:hover { background: var(--slate); border-color: var(--slate); color: #fff; }
.b4-pill { background: var(--panel); font: 600 12.5px var(--mono); border-radius: 4px; }
a.b4-pill:hover { border-color: var(--accent); color: var(--accent); }
.b4-pill--accent { border-color: var(--accent); color: var(--accent); }
.b4-kicker { margin: 0 0 8px; font: 700 12px var(--mono); letter-spacing: .16em; color: var(--accent); text-transform: uppercase; }

/* ---------- 首頁 ---------- */
.b4-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 36px; align-items: end; padding: 38px 0 28px; }
.b4-intro h1 { display: grid; gap: 8px; }
.b4-h1__brand { font-size: clamp(34px, 5vw, 62px); line-height: 1.08; letter-spacing: .02em; }
.b4-h1__tag { font-size: clamp(16px, 1.8vw, 20px); font-weight: 500; color: var(--muted); }
.b4-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; list-style: none; margin: 0; padding: 0; }
.b4-kpis li { padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--radius); }
.b4-kpis__k { display: block; font: 12px var(--mono); color: var(--muted); }
.b4-kpis__v { display: block; font: 800 clamp(24px, 2.6vw, 34px)/1.2 var(--mono); }
.b4-kpis__v small { margin-left: 4px; font: 600 12px var(--sans); color: var(--muted); }
.b4-feature { display: grid; grid-template-columns: 240px minmax(0, 1fr) 300px; gap: 28px; padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 0 -4px rgba(43, 54, 61, .08); }
.b4-feature__poster { display: block; }
.b4-feature__poster img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px; }
.b4-feature__body { min-width: 0; align-self: center; }
.b4-feature__body h2 { font-size: clamp(24px, 2.8vw, 36px); margin-bottom: 6px; }
.b4-feature__body h2 a { display: inline-flex; align-items: center; min-height: 44px; }
.b4-feature__meta { margin: 0 0 12px; font: 12.5px var(--mono); color: var(--muted); }
.b4-feature__syn { color: var(--muted); line-height: 1.85; }
.b4-feature__meters { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 420px; margin: 16px 0 20px; }
.b4-feature__side { padding-left: 24px; border-left: 1px dashed var(--line); min-width: 0; }
.b4-feature__sideh { margin-bottom: 8px; font: 700 12px var(--mono); letter-spacing: .14em; color: var(--muted); }
.b4-feature__side ol { list-style: none; margin: 0; padding: 0; }
.b4-feature__side a { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 52px; border-bottom: 1px solid var(--line); }
.b4-feature__n { font: 700 12px var(--mono); color: var(--accent); }
.b4-feature__st { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.b4-feature__sm { font: 11.5px var(--mono); color: var(--muted); white-space: nowrap; }

/* ---------- 儀表卡 ---------- */
.b4-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.b4-grid--list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.b4-card { display: flex; flex-direction: column; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color .15s, transform .15s, box-shadow .15s; }
.b4-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 10px 18px -10px rgba(43, 54, 61, .45); color: inherit; }
.b4-card__fig { position: relative; display: block; }
.b4-card__fig img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.b4-card__tag { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 3px; background: rgba(31, 40, 46, .82); color: #fff; font: 600 11.5px var(--mono); }
.b4-card__body { display: grid; gap: 10px; padding: 12px 14px 14px; }
.b4-card__t { font-weight: 800; line-height: 1.4; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.8em; }
.b4-card:hover .b4-card__t { color: var(--accent); }
.b4-card__meters { display: grid; gap: 8px; }
.b4-card__m { font: 11.5px var(--mono); color: var(--muted); }

/* ---------- 題材分佈 / 排行 ---------- */
.b4-duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; }
.b4-bars, .b4-rank { list-style: none; margin: 0; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.b4-bars a { display: grid; grid-template-columns: 92px minmax(0, 1fr) 36px; align-items: center; gap: 12px; min-height: 44px; }
.b4-bars a:hover .b4-bars__t { color: var(--accent); }
.b4-bars__t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; }
.b4-bars__bar { display: block; height: 10px; background: #d5dde1; border-radius: 2px; overflow: hidden; }
.b4-bars__bar i { display: block; width: var(--p); height: 100%; background: var(--accent); }
.b4-bars__n { font: 700 12.5px var(--mono); text-align: right; color: var(--muted); }
.b4-rank a { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 48px; border-bottom: 1px dashed var(--line); }
.b4-rank li:last-child a { border-bottom: 0; }
.b4-rank__no { font: 800 15px var(--mono); color: var(--accent); }
.b4-rank li:nth-child(n+4) .b4-rank__no { color: var(--muted); }
.b4-rank__t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.b4-rank__m { font: 12px var(--mono); color: var(--muted); white-space: nowrap; }
.b4-rank a:hover .b4-rank__t { color: var(--accent); }

/* ---------- 列表頁 + 右側固定篩選欄 ---------- */
.b4-pagehead { padding: 22px 0 16px; }
.b4-pagehead h1 { font-size: clamp(26px, 3.4vw, 38px); }
.b4-pagehead h1::before { content: ""; display: inline-block; width: 10px; height: .8em; margin-right: 12px; background: var(--accent); vertical-align: -.05em; }
.b4-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 28px; align-items: start; }
.b4-layout__main { min-width: 0; }
.b4-side { position: sticky; top: 112px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--slate); border-radius: var(--radius); max-height: calc(100vh - 128px); overflow-y: auto; scrollbar-width: thin; }
.b4-side__h { margin-bottom: 8px; font: 700 12px var(--mono); letter-spacing: .14em; color: var(--muted); }
.b4-side .b4-filter { display: grid; gap: 14px; margin: 0; }
.b4-side .b4-filter__row { display: grid; gap: 4px; }
.b4-side .b4-filter__label { font: 700 12px var(--mono); color: var(--accent); }
.b4-side .b4-filter__list { flex-wrap: wrap; gap: 4px; overflow: visible; }
.b4-filter__list a { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); font-size: 13.5px; }
.b4-filter__list a:hover { border-color: var(--accent); color: var(--accent); }
.b4-filter__list a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.sd-pagination .page-numbers { background: var(--panel); border-radius: 4px; font-family: var(--mono); }
.sd-pagination a.page-numbers:hover { border-color: var(--accent); }

/* ---------- 詳情 / 分集 ---------- */
.b4-dhead h1 { font-size: clamp(26px, 3.6vw, 42px); }
.b4-dgrid { gap: 32px; }
.b4-player, .b4-dposter { border: 1px solid var(--slate); border-radius: var(--radius); overflow: hidden; box-shadow: 0 0 0 5px var(--panel), 0 0 0 6px var(--line); }
.b4-dgrid__r { padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.b4-gauges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; margin-bottom: 20px; padding-bottom: 18px; border-bottom: 1px dashed var(--line); }
.b4-gauges__cell { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 8px 12px; background: var(--surface); border-radius: 4px; }
.b4-gauges__cell span { font: 11.5px var(--mono); color: var(--muted); }
.b4-gauges__cell b { font: 700 14px var(--mono); }
.b4-gauges__cell b.is-on { color: var(--accent); }
.b4-gauges__cell b.is-off { color: var(--muted); }
.b4-syn { font-size: 16px; line-height: 1.95; }
.b4-note { background: var(--surface); }
.b4-eps-sec .b4-h2 { display: flex; align-items: center; gap: 8px; font: 700 14px var(--mono); letter-spacing: .12em; padding-bottom: 8px; border-bottom: 2px solid var(--slate); }
.b4-eps { list-style: none; margin: 12px 0 0; padding: 0 2px 2px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 440px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--accent) transparent; }
.b4-eps a, .b4-eps .is-off { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 52px; padding: 0 10px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
.b4-eps a:hover { border-color: var(--accent); }
.b4-eps__n { font: 800 14px var(--mono); color: var(--accent); }
.b4-eps__t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.b4-eps__d { font: 11.5px var(--mono); color: var(--muted); }
.b4-eps__bar { position: absolute; left: 10px; right: 10px; bottom: 6px; height: 3px; background: #d5dde1; border-radius: 2px; overflow: hidden; }
.b4-eps__bar i { display: block; width: var(--p, 0%); height: 100%; background: var(--accent-2); }
.b4-eps .is-current { background: var(--slate); border-color: var(--slate); color: #fff; }
.b4-eps .is-current .b4-eps__n { color: var(--accent-2); }
.b4-eps .is-current .b4-eps__d { color: #b9c7cd; }
.b4-eps .is-off { opacity: .5; }
.b4-facts-sec { padding: 20px 22px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.b4-fact dd { font-family: var(--mono); font-size: 14px; }
.b4-pn a { background: var(--panel); border-radius: var(--radius); font-weight: 700; }
.b4-pn a.is-next { background: var(--accent); color: #fff; }
.b4-faq details { border-bottom: 1px solid var(--line); }
.b4-result { border-bottom: 1px solid var(--line); }
.b4-sf input[type="search"] { background: var(--panel); }
.b4-search__box, .b4-drawer { background: var(--panel); }
.b4-tags a { border-radius: 4px; font-size: 13.5px; }

/* ---------- 頁尾 ---------- */
.b4-foot { margin-top: 80px; padding-top: 36px; background: var(--slate); color: #cfdae0; border-top: 4px solid var(--accent); }
.b4-foot__grid { display: grid; grid-template-columns: 1.4fr 1.2fr 1fr; gap: 20px; }
.b4-panel { padding: 18px 20px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); border-radius: var(--radius); min-width: 0; }
.b4-foot h2 { margin-bottom: 8px; font: 700 12px var(--mono); letter-spacing: .16em; color: var(--accent-2); }
.b4-foot ul { list-style: none; margin: 0; padding: 0; }
.b4-foot li a { display: inline-flex; align-items: center; min-height: 44px; }
.b4-foot li a:hover { color: var(--accent-2); }
.b4-foot__tags { display: flex; flex-wrap: wrap; gap: 0 16px; }
.b4-foot__name { font-size: 22px; font-weight: 800; color: #fff; margin-bottom: 6px; }
.b4-panel p { font-size: 14px; }
.b4-foot__note { color: #8fa3ad; font-size: 12.5px !important; }
.b4-foot__bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin: 22px 0 0; padding: 16px 0 26px; font: 12px var(--mono); color: #8fa3ad; }

/* ---------- 響應式 ---------- */
@media (max-width: 1200px) {
  .b4-feature { grid-template-columns: 200px minmax(0, 1fr); }
  .b4-feature__side { grid-column: 1 / -1; padding: 14px 0 0; border-left: 0; border-top: 1px dashed var(--line); }
  .b4-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .b4-nav { display: none; }
  .b4-tool--menu { display: inline-flex; }
  .b4-intro { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .b4-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .b4-side { position: static; order: -1; max-height: none; overflow: visible; padding: 12px 14px; }
  .b4-side .b4-filter { gap: 0; }
  .b4-side .b4-filter__row { display: flex; align-items: center; gap: 10px; }
  .b4-side .b4-filter__list { flex-wrap: nowrap; overflow-x: auto; }
  .b4-grid--list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .b4-duo { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .b4-foot__grid { grid-template-columns: 1fr 1fr; }
  .b4-foot__grid > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .b4-grid, .b4-grid--list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .b4-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .b4-feature { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .b4-feature__poster { max-width: 240px; }
  .b4-card__body { padding: 10px; }
  .b4-gauges { grid-template-columns: minmax(0, 1fr); }
  .b4-status__tag { display: none; }
}
@media (max-width: 560px) {
  .b4-foot__grid { grid-template-columns: minmax(0, 1fr); }
  .b4-feature__meters { grid-template-columns: minmax(0, 1fr); }
  .b4-tool__tx { display: none; }
  .b4-head__in { gap: 12px; }
}
