/*
Theme Name: 爽短剧 Shuang
Theme URI: https://shuangduanju.com/
Author: SD Network
Description: 深色影院风格短剧主题：首屏大标题、横向海报轨道、四列更新网格、追剧榜单。适用于爽短剧（shuangduanju.com）。
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 8.1
Text Domain: sd-shuang
*/

:root {
  --ink: #090b10;
  --ink-2: #10131b;
  --surface: #161a24;
  --surface-2: #1d2230;
  --line: #262c3a;
  --text: #eef1f7;
  --muted: #9aa4b8;
  --accent: #ff3b30;
  --accent-2: #ff8a00;
  --accent-soft: rgba(255, 59, 48, .14);
  --radius: 16px;
  --wrap: 1240px;
  --shadow: 0 18px 44px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 16px/1.65 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button { font: inherit; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.sr-only {
  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: -60px; z-index: 999; padding: 10px 16px;
  background: var(--accent); color: #fff; border-radius: 8px;
}
.skip:focus { top: 12px; }

/* header */
.sh-head {
  position: sticky; top: 0; z-index: 60;
  background: rgba(9, 11, 16, .86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.sh-head.is-stuck { box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.sh-head__in { display: flex; align-items: center; gap: 26px; height: 66px; }
.sh-logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .02em; font-size: 19px; }
.sh-logo__mark {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 17px; box-shadow: 0 6px 18px rgba(255, 59, 48, .35);
}
.sh-nav { display: flex; gap: 6px; margin-left: auto; }
.sh-nav a {
  padding: 8px 12px; border-radius: 9px; color: var(--muted); font-size: 15px;
}
.sh-nav a:hover, .sh-nav a[aria-current="page"] { color: var(--text); background: var(--surface); }
.sh-head__tools { display: flex; gap: 8px; margin-left: 8px; }
.sh-icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer;
}
.sh-icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.sh-menu-btn { display: none; }

/* search panel + drawer */
.sh-search {
  position: fixed; inset: 0; z-index: 90; display: none;
  background: rgba(4, 6, 10, .82); backdrop-filter: blur(8px);
  padding: 90px 20px 20px;
}
.sh-search.is-open { display: block; }
.sh-search form {
  max-width: 640px; margin: 0 auto; display: flex; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px;
}
.sh-search input {
  flex: 1; background: transparent; border: 0; color: var(--text); font-size: 17px; outline: none;
}
.sh-search form button {
  border: 0; border-radius: 10px; padding: 10px 22px; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 700;
}
.sh-search__hint { max-width: 640px; margin: 18px auto 8px; color: var(--muted); font-size: 14px; }
.sh-tags { max-width: 640px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 8px; }
.sh-tags a { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.sh-tags a:hover { border-color: var(--accent); color: var(--accent); }

.sh-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 95; width: min(320px, 82vw);
  background: var(--ink-2); border-left: 1px solid var(--line);
  padding: 22px; transform: translateX(102%); transition: transform .25s ease;
  display: flex; flex-direction: column; gap: 4px; overflow-y: auto;
}
.sh-drawer.is-open { transform: translateX(0); }
.sh-drawer a { padding: 11px 12px; border-radius: 9px; color: var(--text); }
.sh-drawer a:hover { background: var(--surface); }
.sh-drawer__close { align-self: flex-end; background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }

/* hero */
.sh-hero {
  position: relative; overflow: hidden; padding: 66px 0 54px;
  background:
    radial-gradient(900px 340px at 12% -10%, rgba(255, 59, 48, .30), transparent 70%),
    radial-gradient(700px 300px at 88% 0%, rgba(255, 138, 0, .18), transparent 72%),
    var(--ink);
  border-bottom: 1px solid var(--line);
}
.sh-hero__kicker { color: var(--accent-2); letter-spacing: .16em; font-size: 13px; margin: 0 0 12px; }
.sh-hero h1 {
  margin: 0 0 14px; font-size: clamp(34px, 6vw, 64px); line-height: 1.08; letter-spacing: -.02em;
  font-weight: 900;
}
.sh-hero h1 em {
  font-style: normal;
  background: linear-gradient(96deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sh-hero p { max-width: 620px; color: var(--muted); font-size: 17px; margin: 0 0 26px; }
.sh-hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.sh-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600;
  cursor: pointer;
}
.sh-btn:hover { border-color: var(--accent); color: var(--accent); }
.sh-btn--primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff; box-shadow: 0 12px 28px rgba(255, 59, 48, .32);
}
.sh-btn--primary:hover { color: #fff; filter: brightness(1.06); }

/* sections */
.sh-section { padding: 46px 0 8px; }
.sh-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.sh-section__head h2 { margin: 0; font-size: 23px; letter-spacing: -.01em; }
.sh-section__head h2 span { color: var(--accent); font-size: 14px; margin-left: 10px; font-weight: 500; }
.sh-section__head a { color: var(--muted); font-size: 14px; }
.sh-section__head a:hover { color: var(--accent); }

/* rail */
.sh-rail { display: flex; gap: 14px; overflow-x: auto; padding: 4px 4px 18px; scroll-snap-type: x mandatory; }
.sh-rail::-webkit-scrollbar { height: 6px; }
.sh-rail::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.sh-rail a { flex: 0 0 210px; scroll-snap-align: start; }
.sh-rail img { width: 210px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 14px; background: var(--surface); }
.sh-rail b { display: block; margin-top: 9px; font-size: 15px; font-weight: 600; }
.sh-rail small { color: var(--muted); font-size: 13px; }

/* grid */
.sh-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.sh-grid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.sh-card { display: block; }
.sh-card__poster { position: relative; border-radius: 14px; overflow: hidden; background: var(--surface); }
.sh-card__poster img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; transition: transform .35s ease; }
.sh-card:hover .sh-card__poster img { transform: scale(1.04); }
.sh-card__badge {
  position: absolute; left: 8px; bottom: 8px; padding: 4px 9px; border-radius: 7px;
  background: rgba(0, 0, 0, .72); font-size: 12px; color: #fff; backdrop-filter: blur(4px);
}
.sh-card__title {
  margin: 10px 0 3px; font-size: 15px; font-weight: 600; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sh-card__meta { color: var(--muted); font-size: 13px; }

/* chips */
.sh-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.sh-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); font-size: 14px; background: var(--ink-2);
}
.sh-chip:hover { border-color: var(--accent); color: var(--accent); }
.sh-chip em { font-style: normal; font-size: 12px; opacity: .7; }

/* rank list */
.sh-rank { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 28px; }
.sh-rank a { display: flex; align-items: center; gap: 14px; padding: 11px 12px; border-radius: 12px; border: 1px solid transparent; }
.sh-rank a:hover { background: var(--ink-2); border-color: var(--line); }
.sh-rank__no {
  width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 9px; background: var(--surface); color: var(--muted); font-weight: 800; font-size: 14px;
}
.sh-rank a:nth-child(-n+3) .sh-rank__no { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.sh-rank__t { flex: 1; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-rank__e { color: var(--muted); font-size: 13px; }

/* archive */
.sh-page-head { padding: 42px 0 6px; }
.sh-page-head h1 { margin: 0 0 8px; font-size: clamp(26px, 3.6vw, 38px); }
.sh-page-head p { color: var(--muted); margin: 0; }

/* crumbs */
.sd-crumbs { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; color: var(--muted); font-size: 14px; padding: 22px 0 4px; }
.sd-crumbs__sep { opacity: .5; }
.sd-crumbs [aria-current="page"] { color: var(--text); }

/* detail */
.sh-detail { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 34px; padding: 26px 0 10px; }
.sh-detail__poster img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 16px; border: 1px solid var(--line); }
.sh-detail h1 { margin: 0 0 10px; font-size: clamp(26px, 4vw, 40px); line-height: 1.2; }
.sh-detail__alt { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.sh-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.sh-pill { padding: 5px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.sh-pill--accent { color: var(--accent); border-color: rgba(255, 59, 48, .4); background: var(--accent-soft); }
.sh-syn { color: #c8d0de; font-size: 15.5px; line-height: 1.85; margin: 0 0 20px; }
.sh-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.sh-block { padding: 34px 0 0; }
.sh-block h2 { font-size: 21px; margin: 0 0 14px; }
.sh-block h2 small { color: var(--muted); font-size: 14px; font-weight: 400; margin-left: 8px; }

/* player */
.sh-player { border-radius: 16px; overflow: hidden; background: #000; border: 1px solid var(--line); }
.sh-player video { display: block; width: 100%; max-height: 74vh; background: #000; }
.sh-player iframe { display: block; width: 100%; aspect-ratio: 9 / 16; border: 0; }

/* episodes */
.sh-eps { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.sh-eps a {
  display: grid; place-items: center; height: 42px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 14px;
}
.sh-eps a:hover { border-color: var(--accent); color: var(--accent); }
.sh-eps a.is-current { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }

/* facts */
.sh-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.sh-fact { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.sh-fact dt { color: var(--muted); font-size: 13px; margin: 0 0 4px; }
.sh-fact dd { margin: 0; font-size: 15px; }

/* faq */
.sh-faq details { border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; margin-bottom: 10px; background: var(--ink-2); }
.sh-faq summary { cursor: pointer; padding: 14px 0; font-weight: 600; }
.sh-faq p { margin: 0 0 14px; color: var(--muted); }

/* prev/next */
.sh-pn { display: flex; justify-content: space-between; gap: 10px; margin: 18px 0 0; }
.sh-pn a { flex: 1; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; font-size: 14px; }
.sh-pn a:hover { border-color: var(--accent); }
.sh-pn a:last-child { text-align: right; }

/* footer */
.sh-foot { margin-top: 60px; border-top: 1px solid var(--line); background: var(--ink-2); padding: 42px 0 26px; }
.sh-foot__grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 30px; }
.sh-foot h2 { font-size: 15px; margin: 0 0 12px; }
.sh-foot p { color: var(--muted); font-size: 14px; margin: 0 0 10px; }
.sh-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sh-foot a { color: var(--muted); font-size: 14px; }
.sh-foot a:hover { color: var(--accent); }
.sh-foot__bottom { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }

/* tabbar */
.sh-tabbar { display: none; }

/* pagination */
.sd-pagination { margin: 30px 0 10px; }
.sd-pagination .nav-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.sd-pagination a, .sd-pagination span {
  min-width: 40px; text-align: center; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--line); color: var(--muted);
}
.sd-pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 404 / search */
.sh-empty { padding: 60px 0; color: var(--muted); }
.sh-result { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.sh-result img { width: 76px; height: 104px; object-fit: cover; border-radius: 10px; }

@media (max-width: 1080px) {
  .sh-grid, .sh-grid--5 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sh-detail { grid-template-columns: 240px minmax(0, 1fr); gap: 24px; }
  .sh-nav { display: none; }
  .sh-menu-btn { display: grid; }
}
@media (max-width: 860px) {
  .sh-grid, .sh-grid--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .sh-rank { grid-template-columns: 1fr; }
  .sh-detail { grid-template-columns: 1fr; }
  .sh-detail__poster { max-width: 220px; }
  .sh-foot__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .sh-grid, .sh-grid--5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sh-hero { padding: 44px 0 38px; }
  .sh-rail a { flex-basis: 150px; }
  .sh-rail img { width: 150px; }
  .sh-foot { padding-bottom: 74px; }
  .sh-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; display: flex;
    background: rgba(9, 11, 16, .96); border-top: 1px solid var(--line);
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    backdrop-filter: blur(12px);
  }
  .sh-tabbar a { flex: 1; text-align: center; color: var(--muted); font-size: 12px; display: grid; gap: 3px; }
  .sh-tabbar a.is-active { color: var(--accent); }
  .sh-tabbar b { font-size: 17px; font-weight: 400; }
  .sh-head__in { height: 58px; gap: 12px; }
  .sh-logo { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

/* 播放器（template-parts/player.php 共用标记） */
.sd-player { border-radius: inherit; background: #000; }
.sd-player video { display: block; width: 100%; max-height: 74vh; background: #000; }
.sd-player iframe { display: block; width: 100%; aspect-ratio: 9 / 16; border: 0; }
.sd-player__fallback { padding: 20px; color: var(--muted); font-size: 14px; }
.sd-callout { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; background: var(--ink-2); }
.sd-callout__title { font-weight: 700; margin-bottom: 6px; }
.sd-callout__desc { color: var(--muted); font-size: 14px; }

/* ===== 共享工具页样式（u-*，随主题变量） ===== */
.u-page { padding: 34px 0 10px; }
.u-page h1 { font-size: clamp(24px, 3.4vw, 36px); margin: 0 0 8px; }
.u-page p { color: var(--muted); margin: 0 0 6px; }
.u-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin: 22px 0 8px; }
.u-card { display: block; }
.u-card img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: calc(var(--radius, 10px) / 2); background: rgba(120, 120, 120, .12); }
.u-card b { display: block; margin: 8px 0 2px; font-size: 15px; line-height: 1.45; font-weight: 600; }
.u-card span { display: block; color: var(--muted); font-size: 13px; }
.u-empty { padding: 46px 0; color: var(--muted); }
.u-search { display: flex; gap: 8px; max-width: 520px; margin: 16px 0 10px; }
.u-search input { flex: 1; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: inherit; }
.u-search button { padding: 11px 20px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; }
.u-result { display: flex; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.u-result img { width: 70px; height: 96px; object-fit: cover; border-radius: 8px; }
.u-meta { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.u-btn { display: inline-block; padding: 10px 18px; border: 1px solid var(--line); border-radius: 8px; }
.u-article { padding-top: 30px; }
.u-prose { line-height: 1.9; }
@media (max-width: 900px) { .u-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .u-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }

