/* 小小影院 · 移动端儿童视频门户 */
:root {
  --bg: #fff7ef;
  --card: #ffffff;
  --ink: #40302a;
  --sub: #9a8a80;
  --pri: #ff7a45;
  --pri2: #ffb347;
  --ok: #3fbf7f;
  --line: #f2e6d9;
  --r: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191512;
    --card: #262019;
    --ink: #f3e9df;
    --sub: #a49488;
    --line: #383026;
  }
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; border: 0; background: none; color: inherit; cursor: pointer; }
input, select { font-family: inherit; font-size: 16px; }
img { display: block; }

/* ---------- 首页头部 ---------- */
.top {
  background: linear-gradient(135deg, #ff8a5c, #ff5d73);
  color: #fff;
  padding: calc(14px + env(safe-area-inset-top)) 16px 18px;
  border-radius: 0 0 26px 26px;
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.logo {
  font-size: 26px; width: 44px; height: 44px; display: grid; place-items: center;
  background: rgba(255,255,255,.22); border-radius: 14px;
}
.brand h1 { font-size: 20px; letter-spacing: 1px; }
.brand p { font-size: 12px; opacity: .85; }
#q {
  width: 100%; border: 0; border-radius: 999px; padding: 11px 16px;
  background: rgba(255,255,255,.95); color: #40302a; outline: none;
}
#q::placeholder { color: #b0a094; }

.wrap { padding: 14px 14px 8px; }
.sec { font-size: 16px; margin: 14px 2px 10px; }
.muted { color: var(--sub); }
.small { font-size: 12px; line-height: 1.7; }
.center { text-align: center; }
.nowrap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 继续看 ---------- */
.hscroll { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.cont {
  flex: 0 0 150px; background: var(--card); border-radius: var(--r); padding: 8px;
  box-shadow: 0 4px 14px rgba(64,48,42,.07); display: flex; flex-direction: column; gap: 5px;
}
.cont b { font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cont .meta { font-size: 11px; color: var(--sub); }
.bar { height: 5px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--pri), var(--pri2)); border-radius: 99px; }

/* ---------- 分类 chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; font-size: 13px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
}
.chip.on { background: linear-gradient(135deg, var(--pri), var(--pri2)); color: #fff; border-color: transparent; font-weight: 600; }

/* ---------- 卡片网格 ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card { background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: 0 4px 14px rgba(64,48,42,.07); transition: transform .12s; }
.card:active { transform: scale(.96); }
.card .ct { padding: 9px 10px 11px; }
.card .ct b { display: block; font-size: 13.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.meta { font-size: 11px; color: var(--sub); }
.cv {
  position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden;
}
.cv img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cv .ph {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 34px; opacity: .9;
}
.cv.big { aspect-ratio: 16 / 9; border-radius: 14px; }

/* ---------- 子页头部 ---------- */
.sub {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  background: var(--card); padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  border-bottom: 1px solid var(--line);
}
.sub b { font-size: 16px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub.ondark { background: #171310; color: #fff; border-bottom-color: #171310; }
.back {
  width: 34px; height: 34px; border-radius: 50%; font-size: 22px; line-height: 1;
  background: var(--line); color: var(--ink); display: grid; place-items: center; padding-bottom: 3px;
}
.back.light { background: rgba(255,255,255,.16); color: #fff; }
.timechip { font-size: 11px; background: rgba(255,255,255,.16); color: #fff; padding: 5px 9px; border-radius: 999px; white-space: nowrap; }

/* ---------- 详情页 ---------- */
.cardx { background: var(--card); border-radius: var(--r); padding: 14px; box-shadow: 0 4px 14px rgba(64,48,42,.07); }
.hero .cv.big { margin-bottom: 12px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag { font-size: 11px; padding: 4px 9px; border-radius: 999px; background: var(--line); color: var(--sub); }
.tag.src { background: #fdece3; color: #e2703a; }
.desc { font-size: 13px; line-height: 1.7; color: var(--sub); margin-bottom: 12px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; border-radius: 14px; padding: 10px 16px;
  background: linear-gradient(135deg, var(--pri), var(--pri2)); color: #fff;
  font-size: 15px; font-weight: 600; margin-top: 8px; width: 100%;
}
.btn:active { opacity: .85; }
.btn.ghost { background: var(--line); color: var(--ink); font-weight: 500; }
.btn.off { opacity: .4; pointer-events: none; }
.hero .btn { margin-top: 6px; }
.hero .btn + .btn { margin-top: 8px; }

/* ---------- 分集 ---------- */
.eps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ep {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 11px; font-size: 12.5px; line-height: 1.45; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ep:active { border-color: var(--pri); }
.ep.done { color: var(--sub); }

/* ---------- 播放页 ---------- */
.stage { position: relative; aspect-ratio: 16 / 9; background: #000; }
.stage iframe, .stage video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.stage .bigopen {
  position: absolute; left: 10%; right: 10%; top: 50%; transform: translateY(-50%); margin: 0;
}
.pchips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; }
.pchips::-webkit-scrollbar { display: none; }
.pchip {
  flex: 0 0 auto; min-width: 40px; height: 36px; padding: 0 10px;
  display: grid; place-items: center; border-radius: 10px; font-size: 13px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
}
.pchip.on { background: linear-gradient(135deg, var(--pri), var(--pri2)); color: #fff; border-color: transparent; font-weight: 700; }
.navrow { display: flex; gap: 10px; margin-top: 12px; }
.navrow .btn { flex: 1; margin-top: 0; }

/* ---------- 家长页 ---------- */
.stat { display: flex; gap: 10px; }
.stat > div { flex: 1; text-align: center; padding: 10px 0; background: var(--line); border-radius: 14px; }
.stat b { display: block; font-size: 24px; color: var(--pri); }
.stat span { font-size: 11px; color: var(--sub); }
.form label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 8px; line-height: 1.5; }
.form input, .form select {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--bg); color: var(--ink); margin-bottom: 10px; outline: none;
}
.form input:focus, .form select:focus { border-color: var(--pri); }
.crow { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.crow:last-child { border-bottom: 0; }
.crow a { flex: 1; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini { font-size: 12px; color: #e05b5b; padding: 6px 10px; background: #fdeaea; border-radius: 10px; }
.links { display: flex; flex-direction: column; gap: 2px; }
.links a { padding: 11px 2px; font-size: 14px; border-bottom: 1px solid var(--line); }
.links a:last-child { border-bottom: 0; }
.switchrow { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; padding: 4px 0 10px; }
.switchrow input { width: 24px; height: 24px; accent-color: var(--pri); flex: 0 0 auto; }
.viderr { position: absolute; inset: 0; display: grid; place-items: center; background: #000; color: #fff; font-size: 14px; padding: 20px; text-align: center; }
.viderr[hidden] { display: none; }
.gate { text-align: center; padding: 28px 18px; }
.gateq { font-size: 30px; font-weight: 700; margin-bottom: 16px; }
.gate input { width: 130px; text-align: center; font-size: 22px; padding: 10px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); outline: none; margin-bottom: 6px; }
.empty { text-align: center; padding: 60px 20px; color: var(--sub); font-size: 15px; }
.empty .muted { font-size: 12.5px; margin-top: 8px; }

/* ---------- 底部导航 ---------- */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; background: var(--card);
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.tab { flex: 1; padding: 8px 0; font-size: 12.5px; color: var(--sub); border-radius: 12px; }
.tab.active { color: var(--pri); font-weight: 700; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: calc(96px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: rgba(23,19,16,.92); color: #fff; font-size: 13px;
  padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: all .25s; z-index: 99; max-width: 80vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
