/* xinghuo layout-apptab — 1:1 look of the huangguotv.ai web app (desktop + mobile), our own CSS.
   Measured from the live site (Playwright, 1600×900 + 390×844). Enqueued only when xinghuo_layout() === 'apptab'.
   Colours come from the skin (--xh-bg / --xh-text / --xh-amber / --xh-heat); the reference grey ramp is
   rebuilt with color-mix so light skins (sand) work. Hero + header-over-hero are always dark (.ap-dark).
   Breakpoints = reference: 640 / 768 (mobile ⇄ desktop chrome) / 1024 / 1280. */

body.layout-apptab {
  --ap-gx: 16px;
  --ap-nav-h: 56px;
  --ap-on-acc: var(--xh-on-accent, #fff);
  --ap-hot: var(--xh-amber); /* reference accent-500 (icons, tab, banner CTA); tangerine maps it to its --xh-heat */
  --ap-font: "Geist", "SF Pro Text", -apple-system, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --ap-font-h: "Funnel Sans", var(--ap-font);
  --ap-ease: cubic-bezier(.4, 0, .2, 1);
  font-family: var(--ap-font);
  line-height: 1.5;
  background: var(--xh-bg);
  color: var(--xh-text);
}
/* reference ramp fg-100…700 / bg-700…900, re-derived wherever text/bg are redefined */
body.layout-apptab,
body.layout-apptab .ap-dark {
  --ap-f1: color-mix(in srgb, var(--xh-text) 96%, var(--xh-bg));
  --ap-f2: color-mix(in srgb, var(--xh-text) 88%, var(--xh-bg));
  --ap-f3: color-mix(in srgb, var(--xh-text) 77%, var(--xh-bg));
  --ap-f4: color-mix(in srgb, var(--xh-text) 66%, var(--xh-bg));
  --ap-f5: color-mix(in srgb, var(--xh-text) 53%, var(--xh-bg));
  --ap-f6: color-mix(in srgb, var(--xh-text) 40%, var(--xh-bg));
  --ap-f7: color-mix(in srgb, var(--xh-text) 28%, var(--xh-bg));
  --ap-s7: color-mix(in srgb, var(--xh-text) 36%, var(--xh-bg));
  --ap-s8: color-mix(in srgb, var(--xh-text) 25%, var(--xh-bg));
  --ap-s9: color-mix(in srgb, var(--xh-text) 15%, var(--xh-bg));
}
body.layout-apptab.skin-xinghuo-tangerine { --ap-hot: var(--xh-heat); }
body.layout-apptab .ap-dark { --xh-bg: #0c0c0c; --xh-text: #f6f6f6; color: var(--xh-text); }
@media (min-width: 768px) { body.layout-apptab { --ap-gx: 40px; --ap-nav-h: 64px; } }
@media (min-width: 1024px) { body.layout-apptab { --ap-gx: 56px; } }

body.layout-apptab .xh-wrap { max-width: none; padding: var(--ap-nav-h) var(--ap-gx) 0; }
body.layout-apptab [hidden] { display: none !important; }
.ap-i {
  display: block; flex-shrink: 0; width: 1em; height: 1em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.ap-dot { flex-shrink: 0; width: 2px; height: 2px; border-radius: 50%; background: var(--ap-f6); }
@media (max-width: 639px) { .ap-sm { display: none !important; } }
.ap-badge {
  flex-shrink: 0; padding: 2px 8px; border-radius: 4px; white-space: nowrap;
  font-size: 11px; line-height: 16px; font-weight: 700;
  background: var(--xh-amber); color: var(--ap-on-acc);
}
@keyframes ap-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes ap-spin { to { transform: rotate(360deg); } }

/* —— top bar —— */
.ap-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  color: var(--xh-text);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--xh-bg) 90%, transparent),
    color-mix(in srgb, var(--xh-bg) 40%, transparent), transparent);
  transition: all .5s var(--ap-ease);
}
.ap-nav.is-solid {
  background: color-mix(in srgb, var(--xh-bg) 95%, transparent);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  border-bottom: 1px solid color-mix(in srgb, var(--ap-s9) 80%, transparent);
}
.ap-nav.is-hidden { transform: translateY(-100%); opacity: 0; pointer-events: none; }
html:not(.ap-js) .ap-nav { position: absolute; }
.ap-nav-in {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: var(--ap-nav-h); padding: 0 var(--ap-gx);
}
.ap-nav-l { display: flex; align-items: center; gap: 24px; min-width: 0; }
.ap-brand {
  flex-shrink: 0; font-family: var(--ap-font-h); font-size: 20px; line-height: 28px; font-weight: 700;
  letter-spacing: -.01em; color: var(--xh-text); white-space: nowrap;
}
.ap-tabs { display: none; align-items: center; gap: 4px; }
.ap-tabs a {
  padding: 6px 16px; border-radius: 999px; white-space: nowrap;
  font-size: 14px; line-height: 20px; font-weight: 500; color: var(--ap-f4);
  transition: all .15s var(--ap-ease);
}
.ap-tabs a:hover { color: var(--ap-f2); }
.ap-tabs a[aria-current] { color: var(--xh-text); background: color-mix(in srgb, var(--xh-text) 10%, transparent); }
.ap-nav-r { display: flex; align-items: center; gap: 8px; }
.ap-icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--ap-f4);
  font-size: 18px; cursor: pointer; transition: all .15s var(--ap-ease);
}
.ap-icon-btn:hover { color: var(--ap-f2); background: color-mix(in srgb, var(--xh-text) 5%, transparent); }
.ap-search { display: flex; align-items: center; gap: 4px; margin: 0; }
.ap-search-box { position: relative; display: block; }
.ap-search-ico {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 14px; color: var(--ap-f5); pointer-events: none;
}
.ap-search input {
  width: 176px; height: 36px; padding: 0 12px 0 36px; border-radius: 999px; outline: none;
  -webkit-appearance: none; appearance: none;
  border: 1px solid color-mix(in srgb, var(--ap-s8) 80%, transparent);
  background: color-mix(in srgb, var(--ap-s9) 80%, transparent);
  color: var(--ap-f2); font: inherit; font-size: 14px; transition: all .15s var(--ap-ease);
}
.ap-search input::placeholder { color: var(--ap-f6); }
.ap-search input:focus {
  border-color: color-mix(in srgb, var(--ap-hot) 50%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ap-hot) 30%, transparent);
}
.ap-search-close { width: 32px; height: 32px; font-size: 16px; color: var(--ap-f5); }
.ap-search-close:hover { color: var(--ap-f3); background: var(--ap-s9); }
html.ap-js .ap-search:not(.is-open) .ap-search-box,
html.ap-js .ap-search:not(.is-open) .ap-search-close,
html.ap-js .ap-search.is-open .ap-search-toggle,
html:not(.ap-js) .ap-search-toggle,
html:not(.ap-js) .ap-search-close { display: none; }
html.ap-js .ap-search.is-open .ap-search-box,
html.ap-js .ap-search.is-open .ap-search-close { animation: ap-up .8s ease-out both; }
@media (min-width: 768px) {
  .ap-nav-l { gap: 32px; }
  .ap-tabs { display: flex; }
  .ap-nav-r { gap: 12px; }
  .ap-search input { width: 256px; }
}
@media (max-width: 767px) {
  .ap-nav { position: absolute; } /* reference: mobile bar scrolls away; tabs live in the bottom bar */
}

/* —— hero carousel (dark on every skin) —— */
body.layout-apptab .xh-apphero {
  position: relative; overflow: hidden; height: 420px;
  margin: calc(-1 * var(--ap-nav-h)) calc(-1 * var(--ap-gx)) 0;
  background: var(--ap-s9);
}
.xh-ah-slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .3s var(--ap-ease), visibility .3s; }
.xh-ah-slide.is-active { opacity: 1; visibility: visible; }
.xh-ah-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.xh-ah-slide::after {
  content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background:
    linear-gradient(to top, rgba(12,12,12,.9), rgba(12,12,12,.4) 50%, transparent),
    linear-gradient(to right, rgba(12,12,12,.6), transparent 50%);
}
.xh-ah-copy {
  position: absolute; z-index: 10; inset: 0; max-width: 672px;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 0 var(--ap-gx) 40px;
  opacity: 0; transition: opacity .5s var(--ap-ease);
}
.is-active .xh-ah-copy { opacity: 1; transition-delay: .15s; }
.xh-ah-badges { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.xh-ah-genre {
  padding: 2px 8px; border-radius: 4px; white-space: nowrap; font-size: 11px; line-height: 16px; font-weight: 500;
  color: var(--xh-text);
}
.xh-ah-title {
  margin: 0 0 8px; font-family: var(--ap-font-h); font-size: 24px; line-height: 1.25; font-weight: 700;
  color: var(--xh-text); letter-spacing: 0;
}
.xh-ah-syn {
  margin: 0 0 16px; font-size: 14px; line-height: 1.625; color: color-mix(in srgb, var(--xh-text) 80%, transparent);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.xh-ah-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 16px;
  font-size: 12px; line-height: 16px; color: color-mix(in srgb, var(--xh-text) 90%, transparent);
}
.xh-ah-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.xh-ah-play, .xh-ah-more {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; border-radius: 999px;
  font-size: 14px; line-height: 20px; white-space: nowrap; transition: all .15s var(--ap-ease);
}
.xh-ah-play { font-weight: 600; background: var(--xh-amber); color: var(--ap-on-acc); }
.xh-ah-play .ap-i { width: 20px; height: 20px; }
.xh-ah-play:hover { transform: scale(1.05); background: color-mix(in srgb, var(--xh-amber) 90%, transparent); color: var(--ap-on-acc); }
.xh-ah-more { font-weight: 500; color: var(--xh-text); background: transparent; }
.xh-ah-more .ap-i { width: 20px; height: 20px; padding: 2px; }
.xh-ah-more:hover { color: var(--xh-text); }
.xh-ah-dots {
  position: absolute; z-index: 20; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
}
.xh-ah-dots button {
  width: 8px; height: 4px; padding: 0; border: 0; border-radius: 999px; cursor: pointer;
  background: color-mix(in srgb, var(--xh-text) 30%, transparent); transition: all .15s var(--ap-ease);
}
.xh-ah-dots button:hover { background: color-mix(in srgb, var(--xh-text) 50%, transparent); }
.xh-ah-dots button.is-on { width: 24px; background: var(--xh-amber); }
.xh-ah-thumbs { display: none; }
@media (min-width: 768px) {
  body.layout-apptab .xh-apphero { height: 620px; }
  .xh-ah-copy { justify-content: center; padding-bottom: 0; }
  .xh-ah-badges { margin-bottom: 16px; }
  .xh-ah-title { font-size: 48px; margin-bottom: 12px; }
  .xh-ah-syn { font-size: 16px; -webkit-line-clamp: 3; margin-bottom: 24px; }
  .xh-ah-meta { gap: 12px; font-size: 14px; line-height: 20px; margin-bottom: 24px; }
  .xh-ah-actions { gap: 12px; }
  .xh-ah-play, .xh-ah-more { gap: 8px; padding: 12px 24px; }
  .xh-ah-dots { bottom: 32px; }
}
@media (min-width: 1024px) {
  .xh-ah-thumbs {
    position: absolute; z-index: 20; right: 56px; top: 80px; bottom: 0; overflow: hidden;
    display: flex; flex-direction: column; gap: 12px; padding: 4px; /* reference: starts under the header, clipped by the hero */
  }
  .xh-ah-thumbs button {
    position: relative; flex-shrink: 0; width: 112px; height: 64px; padding: 0; border: 0; border-radius: 8px;
    overflow: hidden; cursor: pointer; opacity: .5; background: var(--ap-s8); transition: all .15s var(--ap-ease);
  }
  .xh-ah-thumbs button:hover { opacity: .8; }
  .xh-ah-thumbs button.is-on { opacity: 1; transform: scale(1.05); box-shadow: 0 0 0 2px var(--xh-amber); }
  .xh-ah-thumbs img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; } /* portrait-only covers: keep the face */
  body.layout-apptab .xh-apphero .xh-fit-fg { object-position: 72% 50%; } /* poster right of the copy, left of the thumbs */
}

/* —— home stack: ad banner (flush under hero) → chips → rows → 全部剧集 —— */
.ap-stack { padding-bottom: 64px; }
.ap-stack > * + *, [data-ap-body] > * + * { margin-top: 32px; }
[data-ap-body] { transition: opacity .2s var(--ap-ease); }
[data-ap-body].is-busy { opacity: .5; pointer-events: none; }
@media (min-width: 768px) {
  .ap-stack { padding-bottom: 80px; }
  .ap-stack > * + *, [data-ap-body] > * + * { margin-top: 40px; }
}

/* the ONE labeled ad, styled as the reference's banner card */
body.layout-apptab .xh-ad {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 16px;
  margin: 0; padding: 20px; border-radius: 16px; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--ap-s8) 60%, transparent);
  background:
    linear-gradient(to right, color-mix(in srgb, var(--xh-bg) 95%, transparent), color-mix(in srgb, var(--xh-bg) 75%, transparent) 50%, color-mix(in srgb, var(--xh-bg) 30%, transparent)),
    radial-gradient(120% 160% at 100% 50%, color-mix(in srgb, var(--xh-amber) 30%, transparent), transparent 65%),
    var(--ap-s9);
}
body.layout-apptab .xh-ad .lab {
  padding: 2px 8px; border-radius: 4px; font-size: 11px; line-height: 16px; font-weight: 700; letter-spacing: 0;
  background: color-mix(in srgb, var(--ap-hot) 14%, transparent); color: var(--xh-amber);
}
body.layout-apptab .xh-ad .body {
  flex: 1; min-width: 0; font-family: var(--ap-font-h); font-size: 16px; line-height: 24px; font-weight: 700; color: var(--ap-f1);
}
body.layout-apptab .xh-ad a:not(.xh-ad-media) {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; padding: 10px 20px; border-radius: 999px;
  font-size: 12px; line-height: 16px; font-weight: 600; background: var(--ap-hot); color: var(--ap-on-acc);
  transition: background .15s var(--ap-ease);
}
body.layout-apptab .xh-ad a:not(.xh-ad-media)::after { content: "→"; }
body.layout-apptab .xh-ad a:not(.xh-ad-media):hover { background: var(--xh-amber); }
/* image creative: the picture is the whole card, label overlays it */
body.layout-apptab .xh-ad.xh-ad--img { display: block; padding: 0; background: none; }
body.layout-apptab .xh-ad.xh-ad--img .lab { position: absolute; top: 10px; left: 10px; z-index: 1; background: rgba(0,0,0,.55); color: #fff; }
@media (min-width: 640px) { body.layout-apptab .xh-ad { flex-direction: row; align-items: center; } }
@media (min-width: 768px) {
  body.layout-apptab .xh-ad { padding: 24px; }
  body.layout-apptab .xh-ad .body { font-size: 18px; line-height: 28px; }
}

.ap-chips { display: flex; gap: 8px; overflow-x: auto; padding: 16px 0 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.ap-chips::-webkit-scrollbar, .ap-row::-webkit-scrollbar, .ap-rank-chips::-webkit-scrollbar,
.ap-eps-list::-webkit-scrollbar, .ap-seg::-webkit-scrollbar { display: none; }
.ap-chips a {
  flex-shrink: 0; white-space: nowrap; padding: 8px 16px; border-radius: 999px;
  font-size: 14px; line-height: 20px; font-weight: 500;
  color: var(--ap-f4); background: transparent;
  transition: all .15s var(--ap-ease);
}
.ap-chips a:hover { color: var(--ap-f2); background: color-mix(in srgb, var(--xh-text) 10%, transparent); }
.ap-chips a[aria-current] { color: var(--ap-on-acc); background: var(--xh-amber); }

.ap-h2 { margin: 0 0 16px; font-family: var(--ap-font-h); font-size: 16px; line-height: 24px; font-weight: 700; color: var(--ap-f1); }
.ap-sec-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.ap-sec-head .ap-h2 { margin: 0; }
.ap-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.ap-row > .ap-card { flex: 0 0 144px; }
.ap-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .ap-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 768px) {
  .ap-chips { padding-top: 24px; }
  .ap-chips a { padding: 8px 20px; }
  .ap-h2 { font-size: 18px; line-height: 28px; margin-bottom: 20px; }
  .ap-sec-head { margin-bottom: 20px; }
  .ap-row { gap: 12px; }
  .ap-row > .ap-card { flex-basis: 176px; }
  .ap-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
}
@media (min-width: 1024px) { .ap-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .ap-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* segmented 总/月/周 */
.ap-seg {
  display: inline-flex; align-items: center; flex-shrink: 0; max-width: 100%; height: 36px; padding: 4px; overflow-x: auto;
  border-radius: 6px; border: 1px solid var(--ap-s8); background: var(--ap-s9); scrollbar-width: none;
}
.ap-seg a {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; height: 28px; min-width: 58px;
  padding: 0 10px; border-radius: 4px; white-space: nowrap; font-size: 12px; line-height: 16px; font-weight: 500;
  color: var(--ap-f4); transition: color .15s var(--ap-ease), background .15s var(--ap-ease);
}
.ap-seg a:hover { color: var(--ap-f1); }
.ap-seg a[aria-current] { color: var(--ap-on-acc); background: var(--xh-amber); }

/* card */
.ap-card {
  display: block; overflow: hidden; border-radius: 12px; color: inherit;
  background: color-mix(in srgb, var(--ap-s9) 60%, transparent); transition: all .15s var(--ap-ease);
}
.ap-card:hover { background: color-mix(in srgb, var(--ap-s9) 90%, transparent); }
.ap-cover { position: relative; display: block; aspect-ratio: 2 / 3; overflow: hidden; background: var(--ap-s8); }
.ap-cover img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ap-ease); }
.ap-card:hover .ap-cover img { transform: scale(1.1); }
.ap-cover::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, color-mix(in srgb, var(--xh-bg) 80%, transparent), transparent 50%);
}
.ap-card-badge { position: absolute; z-index: 1; top: 8px; left: 8px; padding: 2px 6px; font-size: 10px; line-height: 15px; }
.ap-card-play {
  position: absolute; z-index: 1; inset: 0; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .3s var(--ap-ease);
}
.ap-card:hover .ap-card-play, .ap-card:focus-visible .ap-card-play { opacity: 1; transition-delay: .18s; }
.ap-card-play .ap-i {
  box-sizing: border-box; width: 40px; height: 40px; padding: 9px; border-radius: 50%;
  background: var(--xh-amber); color: var(--ap-on-acc);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
}
.ap-card-info { position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; display: block; padding: 8px; }
.ap-card-t {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--ap-font-h); font-size: 12px; line-height: 1.25; font-weight: 600; color: var(--ap-f1);
}
.ap-card-m { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 10px; line-height: 15px; color: var(--ap-f5); }
.ap-card-foot { display: block; padding: 6px 8px; }
.ap-tag {
  display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: top;
  padding: 2px 6px; border-radius: 4px; white-space: nowrap; font-size: 10px; line-height: 15px;
  color: var(--xh-amber); background: color-mix(in srgb, var(--ap-hot) 10%, transparent);
}
@media (min-width: 768px) {
  .ap-card-play .ap-i { width: 48px; height: 48px; padding: 11px; }
  .ap-card-info { padding: 12px; }
  .ap-card-t { font-size: 14px; }
  .ap-card-m { gap: 8px; margin-top: 4px; font-size: 11px; }
  .ap-card-foot { padding: 8px 12px; }
}

.ap-loader { display: flex; align-items: center; justify-content: center; height: 48px; }
.ap-loader::before {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--ap-f6); border-top-color: transparent; animation: ap-spin 1s linear infinite;
}
.ap-pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 24px 0 0; }
.ap-pager a, .ap-pager button {
  padding: 8px 20px; border-radius: 999px; border: 0; cursor: pointer; font: inherit; font-size: 14px; line-height: 20px; font-weight: 500;
  color: var(--ap-f4); background: color-mix(in srgb, var(--xh-text) 6%, transparent); transition: all .15s var(--ap-ease);
}
.ap-pager a:hover, .ap-pager button:hover { color: var(--ap-f2); background: color-mix(in srgb, var(--xh-text) 10%, transparent); }
.ap-empty { grid-column: 1 / -1; margin: 0; padding: 80px 0; text-align: center; font-size: 14px; color: var(--ap-f6); }

/* —— footer + mobile tab bar —— */
body.layout-apptab .ap-foot {
  margin: 0 calc(-1 * var(--ap-gx)); padding: 32px var(--ap-gx);
  border-top: 1px solid color-mix(in srgb, var(--ap-s9) 80%, transparent); background: var(--xh-bg);
}
.ap-foot-in { display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 16px; }
.ap-foot-note { margin: 0; text-align: center; font-size: 10px; line-height: 1.625; color: var(--ap-f6); }
body.layout-apptab .ap-foot .xh-interlink { justify-content: center; margin-top: 16px; font-size: 12px; }
body.layout-apptab .ap-foot .xh-interlink a { color: var(--ap-f5); }
body.layout-apptab .ap-foot .xh-interlink-label { color: var(--ap-f6); }
@media (min-width: 768px) {
  body.layout-apptab .ap-foot { padding-top: 40px; padding-bottom: 40px; }
  .ap-foot-in { flex-direction: row; gap: 24px; }
  .ap-foot-note { font-size: 12px; }
}
.ap-tabbar { display: none; }
@media (max-width: 767px) {
  body.layout-apptab { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .ap-tabbar {
    position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
    display: flex; align-items: center; justify-content: space-around;
    height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--xh-bg) 95%, transparent);
    -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
    border-top: 1px solid color-mix(in srgb, var(--ap-s9) 80%, transparent);
  }
  .ap-tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    width: 64px; height: 56px; font-size: 10px; line-height: 15px; color: var(--ap-f5); transition: color .15s var(--ap-ease);
  }
  .ap-tabbar .ap-i { box-sizing: border-box; width: 20px; height: 20px; padding: 1px; }
  .ap-tabbar a[aria-current] { color: var(--ap-hot); font-weight: 500; }
  .ap-tabbar a[aria-current] .f { fill: currentColor; }
  .ap-tabbar a[aria-current] .k { stroke: var(--xh-bg); }
}

/* —— drama page (/watch look) —— */
.ap-watch {
  display: flex; flex-direction: column; gap: 16px;
  max-width: calc(1280px - 2 * var(--ap-gx)); margin: 0 auto; padding: 12px 0 64px;
}
.ap-crumb { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ap-back { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 14px; color: var(--ap-f5); transition: color .15s var(--ap-ease); }
.ap-back:hover { color: var(--ap-f3); }
.ap-back .ap-i { box-sizing: border-box; width: 20px; height: 20px; padding: 2px; }
.ap-crumb-sep { color: var(--ap-f7); }
.ap-crumb-t {
  min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--ap-font-h); font-size: 16px; line-height: 24px; font-weight: 600; color: var(--ap-f1);
}
.ap-pill {
  flex-shrink: 0; padding: 4px 10px; border: 0; border-radius: 999px; white-space: nowrap;
  font: inherit; font-size: 12px; line-height: 16px; color: var(--ap-f3);
  background: color-mix(in srgb, var(--ap-s9) 60%, transparent); transition: background .15s var(--ap-ease);
}
@media (max-width: 639px) {
  .ap-watch { margin: 0 -6px; } /* reference uses a 10px gutter here */
  .ap-back span, .ap-crumb-sep { display: none; }
}
.ap-player {
  position: relative; display: flex; flex-direction: column; overflow: hidden; border-radius: 16px; background: #000;
  height: clamp(240px, calc(100vh - 8rem), 760px);
  height: clamp(240px, calc(100svh - 8rem), 760px);
}
.ap-player::after { content: ""; flex-shrink: 0; height: 48px; background: #000; }
body.layout-apptab .ap-player .sk-player {
  --sk-acc: var(--xh-amber);
  flex: 1; min-height: 0; aspect-ratio: auto; max-height: none; border-radius: 0; background: #000;
}
.ap-player .sk-player video, .ap-player > video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.ap-player > video { flex: 1; min-height: 0; }
.ap-player .xh-player-empty { flex: 1; color: #a5a5a5; }
.ap-watch-row { display: flex; flex-direction: column; gap: 16px; }
.ap-watch-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.ap-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ap-pills .ap-pill { padding: 6px 10px; font-size: 14px; line-height: 20px; color: var(--ap-f5); }
.ap-pills .ap-pill-on { color: var(--xh-amber); background: color-mix(in srgb, var(--xh-amber) 10%, transparent); }
.ap-watch-ep { margin: 0; font-family: var(--ap-font-h); font-size: 20px; line-height: 28px; font-weight: 700; color: var(--xh-text); }
.ap-watch-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 14px; line-height: 20px; color: var(--ap-f5); }
.ap-eps-h { margin: 0 0 10px; font-size: 14px; line-height: 20px; font-weight: 600; letter-spacing: .025em; color: var(--ap-f4); }
.ap-eps-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; scrollbar-width: none; }
.ap-ep {
  display: flex; flex-shrink: 0; align-items: center; gap: 10px; height: 64px; padding: 8px 10px;
  border-radius: 8px; border: 1px solid transparent; background: color-mix(in srgb, var(--ap-s9) 40%, transparent);
  transition: all .15s var(--ap-ease);
}
.ap-ep:hover { border-color: var(--ap-s7); background: color-mix(in srgb, var(--ap-s9) 70%, transparent); }
.ap-ep.is-on { border-color: color-mix(in srgb, var(--xh-amber) 60%, transparent); background: color-mix(in srgb, var(--xh-amber) 8%, transparent); }
.ap-ep-th { flex-shrink: 0; width: 80px; height: 48px; overflow: hidden; border-radius: 6px; background: var(--ap-s8); }
.ap-ep-th img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; }
.ap-ep-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ap-ep-t { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ap-f3); }
.ap-ep.is-on .ap-ep-t { color: var(--xh-amber); }
.ap-ep-s { font-size: 10px; line-height: 15px; color: color-mix(in srgb, var(--xh-amber) 70%, #fff); }
.ap-syn { padding: 16px; border-radius: 12px; background: color-mix(in srgb, var(--ap-s9) 40%, transparent); }
.ap-syn-h { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--ap-f3); }
.ap-syn-h .ap-i { box-sizing: border-box; width: 20px; height: 20px; padding: 2px; color: var(--ap-hot); }
.ap-syn-b { font-size: 12px; line-height: 1.625; color: var(--ap-f4); }
.ap-syn-b p { margin: 0 0 .6em; }
.ap-syn-b p:last-child { margin-bottom: 0; }
@media (min-width: 768px) {
  .ap-watch { gap: 24px; padding: 24px 0 80px; }
  .ap-player::after { height: 64px; }
  .ap-watch-row { flex-direction: row; gap: 24px; }
  .ap-watch-info { gap: 16px; }
  .ap-pills .ap-pill { padding: 4px 8px; font-size: 12px; line-height: 16px; }
  .ap-watch-meta { gap: 12px; font-size: 12px; line-height: 16px; }
  .ap-eps { flex-shrink: 0; width: 288px; }
  .ap-eps-h { margin-bottom: 12px; font-size: 12px; line-height: 16px; }
  .ap-eps-list { max-height: 400px; }
  .ap-syn { padding: 20px; }
  .ap-syn-h { margin-bottom: 12px; }
  .ap-syn-b { font-size: 14px; }
}

/* —— 排行榜 / 本机记录 —— */
.ap-rank, .ap-local { padding-bottom: 80px; }
.ap-rank { max-width: 832px; margin: 0 auto; }
.ap-rank-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 20px 0; }
.ap-rank-ico {
  display: flex; flex-shrink: 0; align-items: center; justify-content: center; width: 48px; height: 48px;
  border-radius: 8px; font-size: 24px; color: var(--ap-hot);
}
.ap-rank-tt { min-width: 0; }
.ap-rank-tt h1 { margin: 0; font-size: 24px; line-height: 32px; font-weight: 700; color: var(--xh-text); }
.ap-rank-tt p {
  margin: 4px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; line-height: 16px; color: var(--ap-f5);
}
.ap-local .ap-rank-tt p { white-space: normal; }
.ap-rank-chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  margin: 0 calc(-1 * var(--ap-gx)); padding: 0 var(--ap-gx) 16px;
}
.ap-rank-chips a {
  display: inline-flex; flex-shrink: 0; align-items: center; gap: 4px; height: 40px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--ap-s8); white-space: nowrap; font-size: 14px; font-weight: 500;
  color: var(--ap-f4); background: color-mix(in srgb, var(--ap-s9) 75%, transparent); transition: all .15s var(--ap-ease);
}
.ap-rank-chips a:hover { border-color: var(--ap-s7); color: var(--ap-f1); }
.ap-rank-chips a:active { transform: scale(.97); }
.ap-rank-chips a span { opacity: .7; }
.ap-rank-chips a[aria-current] {
  padding: 0 20px; font-weight: 600; border-color: var(--xh-amber); background: var(--xh-amber); color: var(--ap-on-acc);
  box-shadow: 0 5px 16px color-mix(in srgb, var(--xh-amber) 20%, transparent);
}
.ap-rank-list { display: flex; flex-direction: column; gap: 10px; margin: 0 0 32px; padding: 0; list-style: none; }
.ap-rank-row {
  display: grid; grid-template-columns: 36px 76px minmax(0, 1fr); align-items: center; gap: 12px;
  min-height: 128px; padding: 12px; border-radius: 8px; color: inherit;
  background: color-mix(in srgb, var(--ap-s9) 65%, transparent); transition: background .15s var(--ap-ease);
}
.ap-rank-row:hover { background: var(--ap-s9); }
.ap-rank-n {
  display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%;
  font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ap-f4);
}
.ap-rank-n.is-gold { background: #fbbf24; color: #2a1600; box-shadow: 0 0 0 1px rgba(253,230,138,.7), 0 0 14px rgba(251,191,36,.24); }
.ap-rank-n.is-silver { background: #d1d5db; color: #111827; box-shadow: 0 0 0 1px rgba(255,255,255,.45); }
.ap-rank-n.is-bronze { background: #cd7f32; color: #1f1308; box-shadow: 0 0 0 1px rgba(240,178,122,.55); }
.ap-rank-cv { width: 76px; height: 104px; overflow: hidden; border-radius: 6px; background: var(--ap-s8); }
.ap-rank-cv img { width: 100%; height: 100%; object-fit: cover; }
.ap-rank-tx { display: flex; flex-direction: column; justify-content: center; align-self: stretch; min-width: 0; padding: 4px 0; }
.ap-rank-t { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ap-rank-t strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; line-height: 24px; font-weight: 700; color: var(--ap-f1); }
.ap-rank-t .ap-badge { font-size: 10px; line-height: 15px; }
.ap-rank-syn {
  margin-top: 4px; font-size: 12px; line-height: 20px; color: var(--ap-f5);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ap-rank-m { display: flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 8px; font-size: 11px; line-height: 16px; color: var(--ap-f4); }
.ap-rank-m > span { display: flex; align-items: center; gap: 4px; min-width: 0; }
.ap-rank-m .ap-i { color: var(--xh-amber); }
@media (min-width: 640px) { .ap-rank-head .ap-seg { margin-left: auto; } }
@media (min-width: 768px) {
  .ap-rank, .ap-local { padding-bottom: 96px; }
  .ap-rank-head { padding: 28px 0; }
  .ap-rank-ico { width: 56px; height: 56px; font-size: 30px; }
  .ap-rank-tt h1 { font-size: 30px; line-height: 36px; }
  .ap-rank-tt p { font-size: 14px; line-height: 20px; }
  .ap-rank-chips { margin: 0; padding: 0 0 20px; }
  .ap-rank-list { gap: 12px; }
  .ap-rank-row { grid-template-columns: 44px 92px minmax(0, 1fr); gap: 16px; min-height: 148px; padding: 16px; }
  .ap-rank-cv { width: 92px; height: 124px; }
  .ap-rank-t strong { font-size: 18px; line-height: 28px; }
  .ap-rank-t .ap-badge { font-size: 12px; line-height: 16px; }
  .ap-rank-syn { font-size: 14px; }
  .ap-rank-m { font-size: 12px; }
}
.ap-local .ap-grid { margin-bottom: 8px; }
.ap-rank .xh-ad, .ap-local .xh-ad { margin-top: 32px; }

/* —— 18+ gate (shared markup, reference look) —— */
body.layout-apptab .xh-age { padding: 32px 20px; background: rgba(0,0,0,.9); -webkit-backdrop-filter: none; backdrop-filter: none; }
body.layout-apptab .xh-age-box {
  max-width: 448px; padding: 24px; border-radius: 8px; background: #171717; color: #fff;
  border: 1px solid color-mix(in srgb, var(--ap-hot) 45%, transparent); box-shadow: 0 25px 50px -12px rgba(0,0,0,.25);
}
body.layout-apptab .xh-age-badge {
  display: flex; width: 64px; height: 64px; margin: 0 auto; border: 0; font-size: 20px; font-weight: 900;
  background: var(--ap-hot); color: #000;
}
body.layout-apptab .xh-age h2 { margin: 28px 0 0; font-size: 24px; line-height: 32px; font-weight: 700; color: #fff; }
body.layout-apptab .xh-age p { margin: 16px 0 0; font-size: 14px; line-height: 28px; color: #d4d4d4; }
body.layout-apptab .xh-age-actions { margin-top: 24px; gap: 8px; }
body.layout-apptab .xh-age .xh-cta {
  min-height: 48px; padding: 12px 16px; border-radius: 8px; font-size: 16px; font-weight: 700;
  background: var(--ap-hot); color: #000; transition: background .15s var(--ap-ease);
}
body.layout-apptab .xh-age .xh-cta:hover { background: var(--xh-amber); }
body.layout-apptab .xh-age .xh-age-leave { border-radius: 8px; border-color: rgba(255,255,255,.12); color: #a3a3a3; }
@media (min-width: 640px) {
  body.layout-apptab .xh-age-box { padding: 32px; }
  body.layout-apptab .xh-age h2 { font-size: 30px; line-height: 36px; }
  body.layout-apptab .xh-age p { font-size: 16px; }
}
