/* ============================================================
   红星短剧 · КиноКлип  —— 移动端优先样式
   ============================================================ */

:root {
  --red: #ff2e4d;
  --red-dark: #e01e3c;
  --red-soft: #fff1f3;
  --orange: #ff7a1a;
  --gold: #ffb400;
  --blue: #2b7fff;

  --bg: #f4f5f7;
  --card: #ffffff;
  --line: #ebedf0;

  --text: #14151a;
  --text-2: #5c6070;
  --text-3: #9a9eab;

  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 2px 12px rgba(20, 21, 26, .06);
  --shadow-lg: 0 8px 28px rgba(20, 21, 26, .14);

  --tabbar-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --grad-red: linear-gradient(135deg, #ff5f6d 0%, #ff2e4d 55%, #e01e3c 100%);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  /* 防止横屏 / 大屏时浏览器自动放大文字 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.no-scroll { overflow: hidden; }

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; border: none; background: none; cursor: pointer; }
input { font: inherit; }
ul, ol { list-style: none; }

#app {
  min-height: 100%;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b));
}

/* ---------------- 顶部栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--grad-red);
  padding-top: var(--safe-t);
  box-shadow: 0 2px 10px rgba(224, 30, 60, .22);
}

.topbar-inner {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: .3px;
  white-space: nowrap;
}

.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: #fff;
  position: relative;
  flex: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 5px 4px;
  background: var(--grad-red);
  border-radius: 2px;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 10px;
  border-radius: 15px;
  background: rgba(255, 255, 255, .2);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .4px;
  transition: background .18s, transform .12s;
  border: 1px solid rgba(255, 255, 255, .28);
}
.lang-switch:active { transform: scale(.94); background: rgba(255, 255, 255, .32); }

.lang-icon {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.6px solid currentColor;
  position: relative;
  flex: none;
}
.lang-icon::before,
.lang-icon::after {
  content: "";
  position: absolute;
  background: currentColor;
}
.lang-icon::before { left: 50%; top: 1px; bottom: 1px; width: 1.2px; margin-left: -.6px; }
.lang-icon::after {
  left: 1px; right: 1px; top: 50%; height: 1.2px; margin-top: -.6px;
  border-radius: 2px;
}

.search-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #fff;
  opacity: .95;
  border-radius: 50%;
  transition: background .15s;
}
.search-btn:active { background: rgba(255, 255, 255, .2); }
.search-btn svg { fill: currentColor; }

.search-btn svg { fill: currentColor; }

/* 搜索展开栏 */
.search-bar {
  display: none;
  align-items: center;
  gap: 7px;
  height: 36px;
  margin: 0 12px 10px;
  padding: 0 10px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
}
.search-bar.show { display: flex; }
.search-bar svg { fill: var(--text-3); flex: none; }
.search-bar input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: none;
  font-size: 13px;
  color: var(--text);
}
.search-bar input::-webkit-search-cancel-button { display: none; }
.search-clear {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--text-3);
  flex: none;
  position: relative;
  display: none;
}
.search-clear::before,
.search-clear::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 8px; height: 1.6px;
  background: #fff;
  border-radius: 1px;
}
.search-clear::before { transform: translate(-50%, -50%) rotate(45deg); }
.search-clear::after { transform: translate(-50%, -50%) rotate(-45deg); }
.search-clear.show { display: block; }

/* ---------------- 通用区块 ---------------- */
.view { animation: fadeIn .22s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.section { margin-top: 10px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px 10px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .2px;
}

.section-title .dot {
  width: 4px;
  height: 15px;
  border-radius: 2px;
  background: var(--grad-red);
}

.section-more {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 2px;
}
.section-more::after {
  content: "";
  width: 5px; height: 5px;
  border-right: 1.4px solid currentColor;
  border-top: 1.4px solid currentColor;
  transform: rotate(45deg);
  margin-left: 1px;
}
[dir="rtl"] .section-more::after { transform: rotate(-135deg); }

/* ---------------- 底部 Tab ---------------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 100;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 600;
  transition: color .15s;
  position: relative;
}
.tab-item svg { width: 22px; height: 22px; fill: currentColor; }
.tab-item.active { color: var(--red); }
.tab-item.active .tab-badge { opacity: 1; transform: none; }

.tab-badge {
  position: absolute;
  top: 4px;
  left: 50%;
  margin-left: 6px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  line-height: 15px;
  text-align: center;
  opacity: 0;
  transform: translateY(3px);
  transition: all .2s;
}

/* Pad / 桌面：底部导航放大并居中，与内容区同宽 */
@media (min-width: 768px) {
  :root { --tabbar-h: 62px; }
  .tabbar {
    max-width: 720px;
    margin-inline: auto;
    border-radius: 16px 16px 0 0;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
  .tab-item { font-size: 11px; gap: 3px; }
  .tab-item svg { width: 24px; height: 24px; }
}

/* ---------------- 海报卡 ---------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 12px 4px;
}
/* 平滑适配：小手机 3 列 → 手机大屏/Pad 4~6 列 */
@media (min-width: 480px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(6, 1fr); } }

.card { position: relative; text-decoration: none; }

.card-title {
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hcard, .vert-card { text-decoration: none; }
.hcard .card-title, .vert-card .card-title { text-decoration: none; }

.poster {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  overflow: hidden;
  background: #dcdfe6;
  box-shadow: var(--shadow);
}

.poster img,
.poster .poster-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.poster-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  padding: 26px 8px 10px;
  text-align: center;
  line-height: 1.3;
  text-shadow: 0 1px 5px rgba(0, 0, 0, .55);
  letter-spacing: .3px;
}

.poster-mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .05) 40%, rgba(0, 0, 0, .68) 100%);
  pointer-events: none;
}

.tag-vip {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 6px;
  border-radius: 4px;
  background: linear-gradient(135deg, #ffd15c, #ff9500);
  color: #4a2600;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}

.tag-eps {
  position: absolute;
  top: 6px;
  left: 6px;
  max-width: calc(100% - 12px);
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .58);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(4px);
}

.poster-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(.85);
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .42);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity .2s, transform .2s;
}
.poster-play::before {
  content: "";
  width: 0; height: 0;
  border-left: 11px solid #fff;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  margin-left: 3px;
}
.card:active .poster-play { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.card-title {
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-sub {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 4px;
}
.card-sub .score { color: var(--gold); font-weight: 700; }

/* 横向滚动行 */
.hscroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0 12px 4px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex: none; }

/* 流式宽度：随屏幕在 104~150px 之间平滑伸缩 */
.hcard { width: clamp(104px, 24vw, 150px); }
.hcard .poster { border-radius: 10px; }

/* ---------------- 顶部轮播 ---------------- */
.hero {
  position: relative;
  margin: 0 12px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  aspect-ratio: 16 / 10;
  max-height: 52vh;
  background: #d6d9e0;
}

/* 宽屏下限制主体宽度，避免元素被拉伸得过大 */
@media (min-width: 700px) {
  .hero { margin: 0 auto 4px; max-width: 600px; }
  .view { max-width: 720px; margin: 0 auto; }
  .topbar-inner, .search-bar { max-width: 720px; margin-left: auto; margin-right: auto; }
  .cat-row, .hscroll, .grid, .rank-list, .section-head, .ep-strip, .hot-words, .vert-row {
    padding-left: 12px; padding-right: 12px;
  }
}

/* Pad 横屏 / 桌面：进一步放宽内容区 */
@media (min-width: 1024px) {
  .view, .topbar-inner, .search-bar { max-width: 1200px; }
  .hero { max-width: none; aspect-ratio: 21 / 9; max-height: 480px; }
  .detail-body { padding: 0 20px; }
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .45s ease;
  cursor: pointer;
}
.hero-slide.active { opacity: 1; }
.hero-slide .hero-img { width: 100%; height: 100%; object-fit: cover; }

.hero-info {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 30px 14px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, .85), rgba(0, 0, 0, 0));
  color: #fff;
}
.hero-info h3 {
  font-size: clamp(16px, 4.5vw, 19px);
  font-weight: 800;
  margin-bottom: 4px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .5);
}
.hero-info p {
  font-size: 12px;
  opacity: .85;
  line-height: 1.45;
  max-height: 2.9em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.hero-info .hero-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-play {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 14px;
  border-radius: 15px;
  background: var(--grad-red);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(255, 46, 77, .4);
}
.btn-play::before {
  content: "";
  width: 0; height: 0;
  border-left: 9px solid #fff;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.hero-dots {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 4px;
  z-index: 3;
}
.hero-dots i {
  width: 5px; height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .5);
  transition: all .25s;
}
.hero-dots i.on { width: 14px; background: #fff; }

/* ---------------- 快捷分类 ---------------- */
.cat-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 12px 4px;
  scrollbar-width: none;
}
.cat-row::-webkit-scrollbar { display: none; }

.cat-chip {
  flex: none;
  height: 31px;
  padding: 0 14px;
  border-radius: 16px;
  background: #fff;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  transition: all .16s;
}
.cat-chip.on {
  background: var(--grad-red);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(255, 46, 77, .3);
}

/* ---------------- 榜单 ---------------- */
.rank-list { padding: 0 12px; }

.rank-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.rank-item:last-child { border-bottom: none; }

.rank-no {
  width: 20px;
  text-align: center;
  font-size: 15px;
  font-weight: 900;
  font-style: italic;
  color: var(--text-3);
  flex: none;
}
.rank-item:nth-child(1) .rank-no { color: #ff3b30; }
.rank-item:nth-child(2) .rank-no { color: #ff9500; }
.rank-item:nth-child(3) .rank-no { color: #f7b500; }

.rank-cover {
  width: 46px;
  aspect-ratio: 3/4;
  border-radius: 7px;
  overflow: hidden;
  flex: none;
  background: #dcdfe6;
  position: relative;
}
.rank-cover img { width: 100%; height: 100%; object-fit: cover; }

.rank-info { flex: 1; min-width: 0; }
.rank-info h4 {
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-info p {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 3px;
  display: flex;
  gap: 8px;
}
.rank-hot { color: var(--red); font-weight: 700; }

.rank-trend { flex: none; font-size: 10.5px; font-weight: 700; }
.trend-up { color: #ff4d4f; }
.trend-down { color: #52c41a; }
.trend-flat { color: var(--text-3); }

/* ---------------- 竖屏精选 ---------------- */
.vert-row { display: flex; gap: 10px; overflow-x: auto; padding: 0 12px 4px; scrollbar-width: none; }
.vert-row::-webkit-scrollbar { display: none; }

.vert-card { width: clamp(112px, 25vw, 156px); }
.vert-cover {
  width: 100%;
  aspect-ratio: 9/16;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: #dcdfe6;
  box-shadow: var(--shadow);
}
.vert-cover img { width: 100%; height: 100%; object-fit: cover; }
.vert-cover .vert-cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 20px 8px 8px;
  background: linear-gradient(to top, rgba(0, 0, 0, .8), transparent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}
.vert-card .card-title { font-size: 12px; }

/* ---------------- 详情页 ---------------- */
.detail {
  background: #fff;
  min-height: 100vh;
  min-height: 100svh; /* 移动浏览器地址栏收放时高度更准 */
  padding-bottom: calc(var(--tabbar-h) + 28px);
}

.detail-hero {
  position: relative;
  height: clamp(170px, 30vw, 250px);
  overflow: hidden;
  background: #222;
}
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.detail-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, #fff 4%, rgba(255, 255, 255, .08) 40%, rgba(0, 0, 0, .3) 100%);
}

.detail-hero-title {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 24px 34px;
  color: #fff;
  font-size: clamp(20px, 6vw, 26px);
  font-weight: 900;
  text-align: center;
  line-height: 1.25;
  letter-spacing: .5px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .55);
}

.detail-nav {
  position: absolute;
  top: var(--safe-t);
  left: 0; right: 0;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 5;
}
.detail-nav button {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .38);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 16px;
}
.detail-nav .nav-share { font-size: 13px; width: auto; padding: 0 12px; border-radius: 16px; }

.detail-body { position: relative; margin-top: -40px; padding: 0 14px; z-index: 3; }

.detail-title {
  font-size: clamp(20px, 5.6vw, 25px);
  font-weight: 900;
  line-height: 1.28;
  letter-spacing: .2px;
}

.detail-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.pill {
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 11px;
  font-weight: 600;
}
.pill.gray { background: #f2f3f5; color: var(--text-2); }
.pill.score { background: #fff7e6; color: #d98600; }

.detail-stat {
  margin-top: 12px;
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--text-3);
}
.detail-stat b { display: block; font-size: 15px; color: var(--text); font-weight: 800; }

.detail-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
}
.btn {
  flex: 1;
  height: 44px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 700;
  transition: transform .12s, opacity .15s;
}
.btn:active { transform: scale(.975); }
.btn-primary { background: var(--grad-red); color: #fff; box-shadow: 0 4px 14px rgba(255, 46, 77, .35); }
.btn-ghost { background: #f2f3f5; color: var(--text); flex: none; width: 52px; }
.btn-ghost.on { background: var(--red-soft); color: var(--red); }
.btn-ghost svg { width: 20px; height: 20px; fill: currentColor; }

.desc-box {
  margin-top: 18px;
  background: #f7f8fa;
  border-radius: var(--radius);
  padding: 12px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.65;
  position: relative;
}
.desc-box.clamped {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.desc-toggle {
  color: var(--blue);
  font-weight: 600;
  font-size: 12px;
  margin-top: 6px;
  display: block;
}

.ep-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 8px;
  scrollbar-width: none;
}
.ep-strip::-webkit-scrollbar { display: none; }
.ep-pill {
  flex: none;
  height: 36px;
  min-width: 40px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f2f3f5;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}
.ep-pill.vip { color: var(--gold); }
.ep-pill em {
  font-style: normal;
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: .3px;
  opacity: .8;
  line-height: 1;
}
.ep-pill.locked { color: var(--text-3); }
.ep-pill.playing { background: var(--red-soft); color: var(--red); }

.detail-block { margin-top: 20px; }
.detail-block h3 {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.detail-block h3 .dot { width: 3px; height: 14px; border-radius: 2px; background: var(--grad-red); }

/* ---------------- 播放器 ---------------- */
.player {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: #000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.player-stage {
  flex: 1;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.stage-bg {
  position: absolute;
  inset: -8%;
  background-size: cover;
  background-position: center;
  filter: blur(26px) brightness(.42) saturate(1.25);
  transform: scale(1.15);
  transition: opacity .3s;
}

.stage-center {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 0 30px;
}

.stage-cover {
  width: min(46vw, 190px);
  aspect-ratio: 3/4;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 50px rgba(0, 0, 0, .6);
  position: relative;
}
.stage-cover img { width: 100%; height: 100%; object-fit: cover; }
.stage-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
  border-radius: 14px;
}

.play-btn {
  width: 62px; height: 62px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255, 255, 255, .3);
  display: grid;
  place-items: center;
  transition: transform .15s, background .2s;
}
.play-btn:active { transform: scale(.92); }
.play-btn::before {
  content: "";
  width: 0; height: 0;
  border-left: 19px solid #fff;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  margin-left: 5px;
}
.play-btn.playing::before {
  border: none;
  width: 18px; height: 20px;
  margin: 0;
  background: linear-gradient(to right, #fff 0 6px, transparent 6px 12px, #fff 12px 18px);
}

/* 上滑提示 */
.hint-swipe {
  position: absolute;
  bottom: 92px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, .55);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  animation: floatUp 2s ease-in-out infinite;
  z-index: 4;
  pointer-events: none;
}
.hint-swipe::before {
  content: "";
  width: 9px; height: 9px;
  border-left: 1.6px solid currentColor;
  border-top: 1.6px solid currentColor;
  transform: rotate(45deg);
}
@keyframes floatUp {
  0%, 100% { opacity: .35; transform: translate(-50%, 6px); }
  50% { opacity: .9; transform: translate(-50%, -4px); }
}

.player-top {
  position: absolute;
  top: var(--safe-t);
  left: 0; right: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .55), transparent);
  color: #fff;
}
.player-top .p-title { flex: 1; min-width: 0; }
.player-top .p-title h4 {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-top .p-title p { font-size: 11.5px; opacity: .7; margin-top: 1px; }
.player-top button {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 15px;
  background: rgba(255, 255, 255, .12);
  flex: none;
}

.player-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 6;
  padding: 24px 12px calc(12px + var(--safe-b));
  background: linear-gradient(to top, rgba(0, 0, 0, .72), transparent);
  color: #fff;
}

.p-progress {
  height: 3px;
  background: rgba(255, 255, 255, .25);
  border-radius: 2px;
  position: relative;
  margin-bottom: 6px;
}
.p-progress .bar {
  height: 100%;
  border-radius: 2px;
  background: var(--red);
  transition: width .25s linear;
}
.p-progress .dot {
  position: absolute;
  top: 50%;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}
.p-time {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  opacity: .65;
  margin-bottom: 8px;
}

.p-actions { display: flex; align-items: center; gap: 8px; }
.p-actions .spacer { flex: 1; }
.p-act {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  opacity: .9;
  min-width: 46px;
  color: #fff;
}
.p-act svg { width: 21px; height: 21px; fill: currentColor; }
.p-act.on { color: var(--red); }
.p-act.on svg { fill: var(--red); }

.p-ctrl {
  height: 34px;
  padding: 0 13px;
  border-radius: 17px;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  backdrop-filter: blur(6px);
}

/* 宽屏播放器：顶栏/底栏与内容区同宽居中，避免按钮横跨整个屏幕 */
@media (min-width: 720px) {
  .player-top, .player-bottom { max-width: 760px; margin-inline: auto; }
}

/* 选集浮层 */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, .5);
  opacity: 0;
  visibility: hidden;
  transition: all .25s;
}
.sheet-mask.show { opacity: 1; visibility: visible; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 401;
  background: #fff;
  border-radius: 18px 18px 0 0;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32, .72, 0, 1);
  max-height: 62vh;
  max-height: 62dvh; /* 小屏浏览器动态地址栏下更准 */
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-b);
}
.sheet.show { transform: none; }

/* 宽屏：底部抽屉改为居中弹窗 */
@media (min-width: 700px) {
  .sheet {
    left: 50%; right: auto; bottom: 50%;
    width: 480px;
    border-radius: 18px;
    transform: translate(-50%, 46%) scale(.97);
    opacity: 0;
    transition: transform .3s cubic-bezier(.32, .72, 0, 1), opacity .22s;
  }
  .sheet.show {
    transform: translate(-50%, 50%) scale(1);
    opacity: 1;
  }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 10px;
  font-size: 15px;
  font-weight: 800;
  position: relative;
}
.sheet-head::before {
  content: "";
  position: absolute;
  top: 7px; left: 50%;
  transform: translateX(-50%);
  width: 34px; height: 4px;
  border-radius: 2px;
  background: #e8eaee;
}
.sheet-close { font-size: 15px; color: var(--text-3); width: 28px; height: 28px; }

.sheet-body {
  overflow-y: auto;
  padding: 6px 14px 18px;
  -webkit-overflow-scrolling: touch;
}

.ep-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; }
@media (min-width: 500px) { .ep-grid { grid-template-columns: repeat(8, 1fr); } }
@media (min-width: 900px) { .ep-grid { grid-template-columns: repeat(10, 1fr); } }

.ep-cell {
  aspect-ratio: 1;
  border-radius: 8px;
  background: #f2f3f5;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  position: relative;
  transition: all .14s;
}
.ep-cell:active { transform: scale(.93); }
.ep-cell em { font-size: 8.5px; font-style: normal; opacity: .75; }
.ep-cell.vip { background: #fff7e6; color: #d98600; }
.ep-cell.locked { background: #f2f3f5; color: var(--text-3); }
.ep-cell.locked::after {
  content: "";
  position: absolute;
  top: 4px; right: 5px;
  width: 8px; height: 6px;
  background: #c9ccd4;
  border-radius: 1px;
  clip-path: polygon(0 30%, 100% 30%, 100% 100%, 0 100%);
}
.ep-cell.playing { background: var(--red-soft); color: var(--red); box-shadow: inset 0 0 0 1.5px var(--red); }

.sheet-tabs {
  display: flex;
  gap: 18px;
  padding: 0 14px 8px;
  border-bottom: 1px solid var(--line);
}
.sheet-tab {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-3);
  padding-bottom: 8px;
  position: relative;
}
.sheet-tab.on { color: var(--text); }
.sheet-tab.on::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: 18px; height: 2.5px;
  border-radius: 2px;
  background: var(--red);
}

/* ---------------- 搜索页 / 空状态 ---------------- */
.empty {
  padding: 70px 30px;
  text-align: center;
  color: var(--text-3);
}
.empty .icon { font-size: 44px; opacity: .3; margin-bottom: 10px; }
.empty p { font-size: 13px; }

.hot-words {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 12px 8px;
}
.word-chip {
  height: 29px;
  padding: 0 12px;
  border-radius: 15px;
  background: #fff;
  font-size: 12.5px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
}
.word-chip.hot { color: var(--red); border-color: #ffd4da; background: var(--red-soft); }

/* ---------------- 我的页 ---------------- */
.profile {
  background: var(--grad-red);
  padding: calc(var(--safe-t) + 18px) 16px 20px;
  color: #fff;
}
.profile-row { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .25);
  display: grid;
  place-items: center;
  font-size: 24px;
  flex: none;
  border: 2px solid rgba(255, 255, 255, .5);
}
.profile-info h3 { font-size: 17px; font-weight: 800; }
.profile-info p { font-size: 12px; opacity: .85; margin-top: 3px; }

.vip-card {
  margin-top: 14px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
}
.vip-card span { opacity: .9; font-weight: 600; font-size: 12px; }

.menu-card {
  margin: 12px;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.menu-item:last-child { border-bottom: none; }
.menu-item .mi-icon {
  width: 26px; height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 14px;
  flex: none;
}
.menu-item .mi-label { flex: 1; }
.menu-item .mi-val { font-size: 12.5px; color: var(--text-3); }
.menu-item::after {
  content: "";
  width: 6px; height: 6px;
  border-right: 1.5px solid var(--text-3);
  border-top: 1.5px solid var(--text-3);
  transform: rotate(45deg);
  flex: none;
}
.menu-item.no-arrow::after { display: none; }

/* ---------------- 提示条 ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 26px);
  transform: translateX(-50%) translateY(12px);
  z-index: 500;
  background: rgba(0, 0, 0, .82);
  color: #fff;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all .25s;
  max-width: 80vw;
  text-align: center;
}
.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%); }

/* ---------------- 小屏优化 ---------------- */
@media (max-width: 340px) {
  .grid { gap: 8px; padding: 0 10px 4px; }
  .card-title { font-size: 12px; }
  .hcard { width: 96px; }
  .vert-card { width: 104px; }
  .ep-grid { grid-template-columns: repeat(4, 1fr); }
  .topbar-inner { height: 44px; }
  .brand { font-size: 16px; }
}

/* ---------------- 横屏手机（矮屏）优化 ---------------- */
@media (max-height: 470px) and (orientation: landscape) {
  .hero { aspect-ratio: 21 / 9; max-height: 46vh; }
  .detail-hero { height: 150px; }
  .detail-hero-title { padding-bottom: 22px; }
  .empty { padding: 30px 30px; }
  .hint-swipe { display: none; }
  .stage-cover { width: min(56vh, 190px); }
  .player-bottom { padding: 14px 16px calc(8px + var(--safe-b)); }
}

/* ---------------- 鼠标设备悬停反馈（桌面 / 接鼠标的 Pad） ---------------- */
@media (hover: hover) and (pointer: fine) {
  .card:hover .poster-play,
  .hcard:hover .poster-play,
  .vert-card:hover .poster-play {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  .cat-chip:hover { border-color: var(--red); color: var(--red); }
  .word-chip:hover { border-color: var(--red); color: var(--red); }
  .tab-item:hover { color: var(--red); }
  .card:hover .poster { box-shadow: var(--shadow-lg); }
}

/* iOS：搜索框字号小于 16px 聚焦时会触发页面自动缩放，规避之 */
@supports (-webkit-touch-callout: none) {
  .search-bar input { font-size: 16px; }
}

/* ================= PC 桌面端（≥1024px） =================
   手机底栏 → 顶栏下方的横向网站导航；内容加宽，去除"手机壳"观感 */
@media (min-width: 1024px) {

  /* 底部导航条改为顶部二级导航 */
  .tabbar {
    top: calc(48px + var(--safe-t));
    bottom: auto;
    z-index: 99;
    max-width: none;
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    border-bottom: 1px solid var(--line);
    justify-content: center;
    gap: 12px;
    padding-bottom: 0;
    box-shadow: 0 2px 10px rgba(20, 21, 26, .05);
  }
  .tab-item {
    flex: none;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    height: 100%;
    padding: 0 20px;
    font-size: 13.5px;
    font-weight: 600;
  }
  .tab-item svg { width: 17px; height: 17px; }
  .tab-item.active {
    box-shadow: inset 0 -2.5px 0 var(--red);
  }
  .tab-badge {
    top: 12px;
    margin-left: 30px;
  }

  /* 顶部导航占位：内容整体下移；底部不再为导航留白 */
  .view { padding-top: var(--tabbar-h); }
  #app { padding-bottom: 40px; }

  /* 分类词在宽屏直接铺开，不再横向滚动 */
  .cat-row { flex-wrap: wrap; overflow: visible; }

  /* 海报栅格加密 */
  .grid { grid-template-columns: repeat(6, 1fr); gap: 14px; }

  /* 详情页 */
  .detail { padding-bottom: 60px; }
  .detail-body { max-width: 960px; margin-left: auto; margin-right: auto; }

  /* 播放器顶/底栏随内容区加宽 */
  .player-top, .player-bottom { max-width: 960px; }

  /* 我的页头部卡片化，避免整屏红色横贯 */
  .profile { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
}

/* 超大屏（≥1600px）：继续加宽并加密栅格 */
@media (min-width: 1600px) {
  .view, .topbar-inner, .search-bar { max-width: 1440px; }
  .grid { grid-template-columns: repeat(8, 1fr); }
}
