/* 影视H5产品 —— 全站样式
 * 视觉/交互定稿见 doc/FRONTEND_DESIGN.md，原型见 doc/prototypes/frontend-preview.html。
 * 这里去掉了原型里"审片工具外壳"(phone frame / review-shell)的样式，只保留真实产品部分，
 * 并从固定尺寸的手机模拟框改成移动端优先的真实视口布局。
 */

:root {
  --ink: #0A0D13;
  --surface: #141924;
  --surface-raised: #1C2330;
  --hairline: #2A3242;
  --text: #F4EEDD;
  --text-muted: #8791A6;
  --gold: #E8AE4D;
  --gold-dim: #7A6534;
  --crimson: #D9524B;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
body { min-height: 100vh; }
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- sticky header (shared: list + play + search) ---------- */
.app-header {
  position: sticky; top: 0; z-index: 8; background: rgba(10,13,19,.96); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--hairline);
  padding-top: env(safe-area-inset-top);
}
.topbar-row { display: flex; align-items: center; gap: 8px; padding: 12px 16px 8px; }
.brand { font-size: 18px; font-weight: 800; color: var(--gold); letter-spacing: .04em; flex: none; cursor: pointer; }
.search-pill {
  flex: 1; min-width: 0; height: 36px; border-radius: 999px; background: var(--surface); border: 1px solid var(--hairline);
  display: flex; align-items: center; gap: 6px; padding: 0 12px; color: var(--text-muted); font-size: 13px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.download-btn {
  flex: none; display: flex; align-items: center; gap: 3px; white-space: nowrap;
  background: linear-gradient(135deg, var(--gold), #B97F2D); color: #241705; border: none;
  border-radius: 999px; padding: 8px 12px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.cat-tabs { display: flex; gap: 18px; padding: 4px 16px 12px; overflow-x: auto; scrollbar-width: none; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex: none; font-size: 14px; padding: 4px 1px 6px; background: none; color: var(--text-muted);
  border: none; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap;
}
.cat-tab.active { color: var(--gold); border-bottom-color: var(--gold); font-weight: 700; }
/* 导航栏"首页"tab后面的广告位挂载点：本身不占布局，子元素(星标广告tab)直接当cat-tabs的
   flex子项参与排列，靠 display:contents 实现"套一层容器但不影响flex布局" */
.cat-tab-star-anchor { display: contents; }
.cat-tab-star {
  color: #FFE28A; font-weight: 800;
  text-shadow: 0 0 6px rgba(255,210,90,.85), 0 0 14px rgba(255,150,20,.55);
  animation: cat-tab-star-glow 1.8s ease-in-out infinite alternate;
}
@keyframes cat-tab-star-glow {
  from { text-shadow: 0 0 4px rgba(255,210,90,.6), 0 0 8px rgba(255,150,20,.35); }
  to   { text-shadow: 0 0 8px rgba(255,225,140,1), 0 0 18px rgba(255,150,20,.75); }
}
@media (prefers-reduced-motion: reduce) { .cat-tab-star { animation: none; } }

.page-shell { max-width: 720px; margin: 0 auto; }

/* ---------- carousel banner 640x200 ---------- */
.carousel { position: relative; margin: 12px 16px 0; border-radius: 12px; overflow: hidden; aspect-ratio: 640 / 200; border: 1px solid var(--hairline); background: var(--surface); }
.carousel-track { display: flex; width: 100%; height: 100%; transition: transform .45s ease; }
.carousel-slide { flex: 0 0 100%; height: 100%; position: relative; display: block; }
.carousel-slide img { width: 100%; height: 100%; object-fit: cover; }
.carousel-slide a { display: block; width: 100%; height: 100%; }
.carousel-dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; z-index: 2; }
.carousel-dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.35); display: block; }
.carousel-dots i.active { background: var(--gold); width: 14px; border-radius: 3px; }

/* ---------- marquee ---------- */
.marquee-bar { display: flex; align-items: center; gap: 8px; margin: 10px 16px 0; padding: 7px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--hairline); }
.marquee-bar .horn { flex: none; font-size: 12px; }
.marquee-viewport { flex: 1; overflow: hidden; position: relative; height: 15px; }
.marquee-track { position: absolute; white-space: nowrap; font-size: 11.5px; color: var(--text-muted); animation: marquee 16s linear infinite; }
@keyframes marquee { from { transform: translateX(100%); } to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .marquee-track { animation: none; position: static; } }

/* ---------- kingkong icon grid (pure inventory, unmarked) ---------- */
.kk-star-wrap { margin: 14px 16px 0; }
.kk-star-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px 6px; }
.kk-star-item { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.kk-star-icon { width: 100%; aspect-ratio: 1 / 1; border-radius: 14px; background: var(--surface); border: 1px solid var(--hairline); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.kk-star-icon img { width: 100%; height: 100%; object-fit: cover; }
.kk-star-item span { font-size: 10px; color: var(--text-muted); text-align: center; line-height: 1.2; }

/* ---------- text ad grid, 5/row, configurable color, unmarked ---------- */
.textstar-wrap { margin: 14px 16px 0; }
.textstar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px 4px; }
.textstar-item {
  font-size: 11px; font-weight: 600; text-align: center; padding: 7px 2px; border-radius: 8px;
  background: var(--surface); border: 1px solid; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- wide video cards 357x201, 2/row ---------- */
.wide-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 12px; padding: 16px; }
.wide-card { display: flex; flex-direction: column; gap: 6px; }
.wide-thumb {
  aspect-ratio: 357 / 201; border-radius: 10px; position: relative; overflow: hidden;
  box-shadow: 0 6px 14px -6px rgba(0,0,0,.6);
}
.wide-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.wide-thumb img.is-broken { display: none; }
.wide-thumb .ghost { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 38px; font-weight: 800; color: rgba(255,255,255,.16); }
.wide-card .title { font-size: 13px; color: var(--text); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- section banner 640x200，非轮播，首页栏目间/列表每5行插一张 ---------- */
.section-banner { display: block; border-radius: 10px; overflow: hidden; aspect-ratio: 640 / 200; }
.section-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 首页：栏目之间的独立一条，横向留白跟 .carousel/.section-title 保持一致 */
.section-banner-anchor { margin: 12px 16px 0; }
.section-banner-anchor:empty { display: none; }
/* 列表页/搜索结果页：插进 .wide-grid 里，横跨所有列，不占列宽 */
.wide-grid .section-banner { grid-column: 1 / -1; }

/* ---------- pagination (纯静态锚点跳转，不依赖JS) ---------- */
.pagination { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 8px 16px 24px; }
.pagination a, .pagination span {
  font-size: 13px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--hairline); color: var(--text-muted);
}
.pagination a { color: var(--text); }
.pagination .current { color: var(--gold); border-color: var(--gold-dim); }

.float-star {
  position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 6;
  max-width: 700px; margin: 0 auto; min-height: 60px;
  border-radius: 14px; display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 8px;
  background: rgba(28,35,48,.96); backdrop-filter: blur(6px); box-shadow: 0 10px 24px -10px rgba(0,0,0,.7);
  transition: transform .2s ease, opacity .2s ease;
  cursor: pointer;
}
.float-star.hidden { transform: translateY(16px); opacity: 0; pointer-events: none; }
.float-star .glyph { width: 60px; height: 60px; border-radius: 10px; flex: none; overflow: hidden; background: linear-gradient(135deg, var(--gold), #B97F2D); }
.float-star .glyph img { width: 100%; height: 100%; object-fit: cover; }
.float-star .copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.float-star .copy strong { display: block; font-size: 15px; color: var(--gold); font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.float-star .copy span { font-size: 12.5px; color: #FF7A6E; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.float-star .cta {
  flex: none; background: linear-gradient(135deg, var(--gold), #B97F2D); color: #241705; border: none;
  border-radius: 999px; padding: 8px 16px; font-size: 12.5px; font-weight: 800; cursor: pointer;
}
.float-star .close { flex: none; width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.1); border: none; color: var(--text-muted); font-size: 13px; cursor: pointer; }

.section-pad { height: 88px; }
.section-title { padding: 16px 16px 2px; font-size: 13px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; }
.section-title .bar { width: 3px; height: 12px; background: var(--gold); border-radius: 2px; }
.section-title .more-link { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--text-muted); }

/* ---------- interstitial popup (multiple, closeable) ---------- */
.interstitial-layer {
  position: fixed; inset: 0; z-index: 25; background: rgba(4,5,8,.66);
  display: flex; align-items: center; justify-content: center; padding: 0 30px;
  transition: opacity .2s ease, visibility .2s ease;
}
.interstitial-layer.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.interstitial-card { width: 100%; max-width: 420px; border-radius: 14px; overflow: hidden; background: var(--surface-raised); border: 1px solid var(--hairline); position: relative; box-shadow: 0 20px 46px -14px rgba(0,0,0,.7); }
.interstitial-card img { width: 100%; display: block; }
.interstitial-close {
  position: absolute; top: 8px; right: 8px; z-index: 2; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.28); color: var(--text); font-size: 15px; cursor: pointer;
}

/* ---------- interstitial: announcement variant (domain notice + QR) ---------- */
.announce-card {
  width: 100%; max-width: 420px; border-radius: 16px; overflow: hidden;
  background: linear-gradient(180deg, var(--surface-raised) 0%, var(--surface) 100%);
  border: 1px solid var(--hairline);
  box-shadow: 0 20px 46px -14px rgba(0,0,0,.7); position: relative; padding: 26px 20px 18px; display: flex; flex-direction: column; gap: 14px;
}
.announce-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold), var(--gold-dim));
}
.announce-capture { display: flex; flex-direction: column; gap: 14px; }
.announce-title {
  text-align: center;
  font-size: 20px; font-weight: 800; color: var(--gold); letter-spacing: .06em;
  text-shadow: 0 0 16px rgba(232,174,77,.35);
}
/* announce-flow 是清除浮动的容器：二维码 float:right 浮在右上角，公告文字正常走块级流，
   碰到二维码高度范围内会自动绕开变窄换行，高度超出二维码之后自动恢复满宽——
   不用JS算文字该多宽，纯CSS float+文档流天然实现"左上角文字环绕右上角二维码" */
.announce-flow { overflow: hidden; }
.announce-qr-wrap {
  float: right; margin: 0 0 10px 14px; width: 76px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
/* .line 故意不用 flex/grid（那些会各自建立一个新的块格式化上下文，导致整块跟二维码
   float"打包"避让、不能逐行变窄再恢复满宽）——用 position 定位小圆点当项目符号，
   保持 .line 是最普通的块级盒子，文字才能像正常文本那样逐行环绕右上角的二维码。 */
.announce-body .line {
  position: relative; padding-left: 14px; margin-bottom: 10px;
  font-size: 14px; line-height: 1.6; color: var(--text);
}
.announce-body .line:last-child { margin-bottom: 0; }
.announce-body .line::before {
  content: ""; position: absolute; left: 0; top: 8px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--gold);
}
.announce-qr-frame {
  background: #fff; padding: 6px; border-radius: 10px; border: 1px solid var(--hairline);
  box-shadow: 0 8px 20px -8px rgba(0,0,0,.5); cursor: pointer;
}
.announce-qr-frame img { display: block; width: 72px; height: 72px; -webkit-touch-callout: default; }
.announce-qr-wrap .cap { font-size: 10px; color: var(--text-muted); font-weight: 600; text-align: center; }
.announce-save-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 4px; padding: 10px 14px; border-radius: 999px; border: 1px dashed var(--gold-dim);
  background: rgba(232,174,77,.08); color: var(--gold); font-size: 11.5px; font-weight: 700; cursor: pointer;
}
.announce-save-btn:active { background: rgba(232,174,77,.18); }
.announce-save-btn .msg { font-weight: 400; color: var(--text-muted); }

/* ---------- player ---------- */
.player { aspect-ratio: 16 / 9; position: relative; background: var(--ink); overflow: hidden; }
.player video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.player-poster { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.player-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.play-btn {
  width: 58px; height: 58px; border-radius: 50%; background: rgba(232,174,77,.92); border: none; color: #241705;
  font-size: 22px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 2;
  box-shadow: 0 8px 20px -6px rgba(232,174,77,.6); position: relative;
}

.preroll-overlay {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; background: rgba(6,8,12,.96);
  transition: opacity .2s ease, visibility .2s ease;
}
.preroll-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.preroll-body { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--surface); overflow: hidden; position: relative; }
.preroll-body img { width: 100%; height: 100%; object-fit: cover; }
.preroll-foot { display: flex; align-items: center; justify-content: flex-end; padding: 8px 10px; }
.preroll-skip {
  background: rgba(255,255,255,.14); color: var(--text); border: none; border-radius: 999px; padding: 6px 14px;
  font-size: 12px; cursor: pointer; font-variant-numeric: tabular-nums;
}

.play-title-block { padding: 14px 16px 2px; }
.play-title-block h1 { font-size: 17px; margin: 0; color: var(--text); font-weight: 800; line-height: 1.4; }

/* ---------- search ---------- */
.search-head { padding: 12px 16px; display: flex; gap: 10px; align-items: center; position: sticky; top: 0; background: var(--ink); z-index: 4; border-bottom: 1px solid var(--hairline); }
.search-input-wrap { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 10px; padding: 0 10px; height: 38px; }
.search-input-wrap input { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-size: 14px; min-width: 0; }
.search-input-wrap input::placeholder { color: var(--text-muted); }
.search-cancel { font-size: 13px; color: var(--gold); cursor: pointer; flex: none; background: none; border: none; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 16px; }
.chip { font-size: 12px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--hairline); color: var(--text-muted); cursor: pointer; }
.hot-chip { display: flex; align-items: center; gap: 5px; }
.hot-chip .rank { font-weight: 800; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.hot-chip.top .rank { color: var(--crimson); }
.search-clear { font-size: 11px; color: var(--text-muted); cursor: pointer; }
/* 搜索结果改成跟列表页同款 .wide-card 网格（见 search.js buildResultCard），
   这里只需要给命中关键词的高亮 <mark> 加个样式 */
.wide-card .title mark { background: transparent; color: var(--gold); font-weight: 700; }
.search-empty { grid-column: 1 / -1; padding: 40px 20px; text-align: center; color: var(--text-muted); font-size: 13px; }

@media (min-width: 700px) {
  .wide-grid { grid-template-columns: repeat(4, 1fr); }
  .kk-star-grid { grid-template-columns: repeat(8, 1fr); }
}
