/* SpiderTV · FongMi 壳子同款配色（从真机截图逐像素采样） */
:root {
  --g1: #a0dfd7;            /* 渐变左上·浅薄荷 */
  --g2: #6eb191;            /* 渐变中·灰绿 */
  --g3: #3fcf9c;            /* 渐变右下·鲜绿 */
  --chip: rgba(15, 55, 40, 0.42);   /* 分类 chip 半透明深绿 */
  --pill: #fffaf1;          /* 底部导航激活药丸·奶白 */
  --fab: #44c99a;           /* 悬浮按钮绿 */
  --ink: #ffffff;
  --ink-2: rgba(255, 255, 255, 0.82);
  --ink-3: rgba(255, 255, 255, 0.6);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: #243b32;
  display: flex; justify-content: center;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }

/* 手机壳容器 */
#phone {
  position: relative;
  width: 100%; max-width: 480px; height: 100vh; height: 100dvh;
  overflow: hidden;
  background: linear-gradient(150deg, var(--g1) 0%, var(--g2) 52%, var(--g3) 100%);
  display: flex; flex-direction: column;
}
@media (min-width: 560px) {
  #phone { max-width: 420px; margin: 14px 0; height: calc(100vh - 28px); border-radius: 28px; box-shadow: 0 24px 70px rgba(0,0,0,.45); }
}

/* ===== 顶部条（分类 + 源行）：播放页时整体隐藏 ===== */
.topbars { flex: 0 0 auto; }
#phone.playing .topbars,
#phone.playing .bottomnav,
#phone.playing #fab { display: none !important; }

/* 源切换行 */
.src-row { display: flex; gap: 7px; padding: 0 14px 10px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.src-row::-webkit-scrollbar { display: none; }
.src-chip {
  flex: 0 0 auto; padding: 5px 13px; border-radius: 16px; border: 1px solid rgba(255,255,255,.4);
  background: rgba(255,255,255,.16); color: var(--ink); font-size: 12px; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.src-chip.active { background: var(--pill); color: #1d4234; border-color: var(--pill); }

/* ===== 视图舞台 ===== */
.stage { flex: 1 1 auto; min-height: 0; position: relative; display: flex; }
.view {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 4px 14px 90px;
  scrollbar-width: none;
}
.view::-webkit-scrollbar { display: none; }

/* 横向滚动容器必须显式声明 touch-action，否则会被祖先的 pan-y 手势规则连带禁用 */
.chips-scroll, .chips-row, .src-row, .info-url { touch-action: pan-x; }

/* ============ 播放详情页（壳子同款） ============ */
.pv { padding: 0; }
.pv-player-wrap { position: sticky; top: 0; z-index: 6; background: #000; }
#pv-player { aspect-ratio: 16/9; width: 100%; background: #000; }
.pv-back {
  position: absolute; top: 10px; left: 10px; z-index: 7;
  border: none; border-radius: 16px; padding: 4px 12px; cursor: pointer;
  background: rgba(0,0,0,.45); color: #fff; font-size: 13px;
  backdrop-filter: blur(4px);
}
.pv-scroll { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.pv-ph { display: flex; align-items: center; justify-content: center; height: 100%; min-height: 120px; color: #8aa; font-size: 13px; }
.pv-info { padding: 12px 16px 4px; }
.pv-info h2 { color: var(--ink); font-size: 20px; line-height: 1.35; text-shadow: 0 1px 3px rgba(10,40,30,.3); }
.pv-meta { color: var(--ink-2); font-size: 12.5px; margin-top: 4px; line-height: 1.7; }
.pv-meta b { color: #ffe08a; font-weight: 700; }
.pv-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px 0; }
.pv-label { flex: 0 0 auto; color: var(--ink-2); font-size: 13px; font-weight: 700; padding-top: 7px; width: 34px; }
.chips-scroll {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  padding: 2px 0; flex: 1 1 auto; min-width: 0;
}
.chips-scroll::-webkit-scrollbar { display: none; }
.pv-chip {
  flex: 0 0 auto; padding: 7px 14px; border-radius: 9px; border: none; cursor: pointer;
  background: rgba(255,255,255,.22); color: var(--ink); font-size: 13.5px; backdrop-filter: blur(3px);
  white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis;
}
.pv-chip.active { background: rgba(20, 60, 42, .5); color: #ffd75e; font-weight: 700; }
.pv-intro { padding: 12px 16px 20px; color: var(--ink-2); font-size: 13px; line-height: 1.8; }

/* ⓘ 真实地址弹窗（壳子同款浅色卡） */
.info-layer { align-items: center; justify-content: center; background: rgba(15, 40, 30, .5); }
.info-card {
  width: 88%; max-height: 80%; overflow-y: auto; scrollbar-width: none;
  background: #f2f6f3; border-radius: 18px; padding: 18px 18px 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.3);
}
.info-title { font-size: 17px; font-weight: 700; color: #1d2b26; margin-bottom: 10px; }
.info-label { font-size: 12px; font-weight: 700; color: #33544a; margin: 10px 0 4px; display: flex; align-items: center; gap: 8px; }
.copy-btn { border: none; background: var(--fab); color: #fff; font-size: 11px; padding: 2px 10px; border-radius: 8px; cursor: pointer; }
.info-ua { font-size: 12px; color: #587d6d; word-break: break-all; line-height: 1.6; }
.info-url {
  font-size: 12px; color: #1a6ce0; word-break: break-all; line-height: 1.7;
  max-height: 108px; overflow-y: auto; background: rgba(29,107,76,.06);
  border-radius: 8px; padding: 8px;
}
.info-note { font-size: 11.5px; color: #a0786a; margin-top: 10px; line-height: 1.6; }
.info-close { display: block; margin: 12px auto 0; border: none; background: rgba(29,66,52,.1); color: #1d4234; padding: 7px 26px; border-radius: 18px; cursor: pointer; font-size: 13px; }

/* 聚合卡片角标 & 换源按钮 */
.pcard .pbox .badge.src { background: rgba(10, 60, 40, .8); color: #7ef0c0; }
.src-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 4px; }
.src-btn {
  padding: 6px 13px; border-radius: 15px; border: 1px solid rgba(29,107,76,.3);
  background: #fff; color: #1d4234; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.src-btn.active { background: var(--fab); border-color: var(--fab); color: #fff; }

/* 配置管理 */
.cfg-box { margin-top: 18px; padding: 14px; border-radius: 14px; background: rgba(29, 107, 76, .08); }
.cfg-title { font-size: 13px; font-weight: 700; color: #1d4234; margin-bottom: 8px; }
.cfg-row { display: flex; gap: 8px; }
#cfg-url { flex: 1; padding: 9px 12px; border-radius: 9px; border: 1px solid rgba(29,107,76,.25); font-size: 12.5px; outline: none; }
.cfg-btn { padding: 0 16px; border: none; border-radius: 9px; background: var(--fab); color: #fff; font-weight: 700; cursor: pointer; }
.cfg-status { font-size: 12px; color: #587d6d; margin: 8px 0 4px; line-height: 1.7; }
.cfg-status .ok { color: #1d6b4c; font-weight: 600; }
.cfg-status .bad { color: #a05252; }
.src-item { font-size: 12.5px; padding: 4px 0; color: #33544a; border-bottom: 1px dashed rgba(29,107,76,.15); }
.src-item .skip { color: #a0786a; font-size: 11.5px; }

/* 分类 chips */
.chips-row { display: flex; gap: 9px; padding: 14px 14px 10px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 8px 18px; border-radius: 20px; border: none;
  background: var(--chip); color: var(--ink); font-size: 14px; font-weight: 600;
  cursor: pointer; backdrop-filter: blur(4px); white-space: nowrap;
}
.chip.active { background: rgba(10, 42, 30, 0.62); }

/* 海报网格：3 列 */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 10px; }
.pcard { cursor: pointer; }
.pcard .pbox {
  position: relative; aspect-ratio: 2/3; border-radius: 13px; overflow: hidden;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28);
  box-shadow: 0 4px 14px rgba(10, 40, 30, .18);
}
.pcard .pbox img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard .pbox .badge {
  position: absolute; left: 6px; bottom: 6px;
  background: rgba(10, 30, 22, .68); color: #ffd75e;
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 7px;
}
.pcard .t {
  margin-top: 6px; color: var(--ink); font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px rgba(10,40,30,.3);
}
.pcard .r { color: var(--ink-3); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 搜索 */
.search-row { display: flex; gap: 8px; margin-bottom: 14px; }
#kw {
  flex: 1; padding: 10px 14px; border-radius: 20px; border: none; outline: none;
  background: rgba(255,255,255,.9); font-size: 14px; color: #234;
}
.go-btn {
  padding: 0 18px; border: none; border-radius: 20px; cursor: pointer;
  background: var(--chip); color: var(--ink); font-size: 14px; font-weight: 600; backdrop-filter: blur(4px);
}
.tip { color: var(--ink-2); font-size: 13px; padding: 14px 4px; }

/* 悬浮回顶 */
.fab {
  position: absolute; right: 16px; bottom: 96px; z-index: 5;
  width: 52px; height: 52px; border-radius: 16px; border: none; cursor: pointer;
  background: var(--fab); color: #fff; font-size: 22px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(10, 60, 40, .35);
}

/* 底部导航（透明底 + 激活药丸） */
.bottomnav {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  display: flex; justify-content: space-around; align-items: center;
  padding: 10px 20px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(20, 60, 42, .28), transparent);
  pointer-events: auto;
}
.bottomnav button {
  border: none; background: transparent; cursor: pointer; padding: 8px 26px; border-radius: 22px;
  font-size: 22px; line-height: 1; transition: background .15s;
}
.bottomnav button.active { background: var(--pill); box-shadow: 0 3px 10px rgba(10, 40, 30, .25); }

/* 通用层（关于等） */
.layer { position: absolute; inset: 0; z-index: 10; background: rgba(12, 36, 26, .45); backdrop-filter: blur(3px); display: flex; align-items: flex-end; }
.sheet {
  width: 100%; max-height: 86%; overflow-y: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  background: linear-gradient(160deg, #eef7f2, #dcefe4);
  border-radius: 22px 22px 0 0; padding: 0 0 26px;
}
.sheet::-webkit-scrollbar { display: none; }
.sheet-head {
  position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px 10px; font-size: 16px; font-weight: 700; color: #1d4234;
  background: linear-gradient(160deg, #eef7f2, #dcefe4);
}
.close-x {
  border: none; background: rgba(29, 66, 52, .1); color: #1d4234;
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 14px;
}
.close-x.light { background: rgba(255,255,255,.18); color: #fff; }
#d-body, .about-body { padding: 0 16px; }
.about-body { color: #33544a; font-size: 13.5px; line-height: 1.9; }
.about-body b { color: #1d4234; }
