/* 短剧付费播放站 —— 移动端优先 */

:root {
  --bg: #fffafd;             /* 页面底色：近乎白的极淡粉 */
  --bg-soft: #fff6fa;        /* 次级底 */
  --card: #ffffff;           /* 卡片 */
  --card-2: #fff3f8;         /* 卡片内嵌 / 按钮底 */
  --line: #ffe8f1;           /* 描边：更淡 */
  --text: #57414c;           /* 主文字：柔和的暖灰紫 */
  --text-2: #85707c;
  --text-3: #b3a2ac;
  --brand: #f77ba7;          /* 主色：降饱和的柔粉 */
  --brand-2: #ffc3dc;        /* 浅粉 */
  --brand-deep: #e8548d;     /* 深粉：渐变按钮末端（保白字可读） */
  --gold: #d99a1f;
  --green: #3fae7c;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; overflow-x: hidden; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; touch-action: manipulation; }

/* ============ 通用 ============ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  background: rgba(255, 247, 250, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: .3px; }
.topbar .back {
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none; color: var(--text); font-size: 22px;
}
.topbar .spacer { flex: 1; }

.wrap { max-width: 640px; margin: 0 auto; padding: 16px; }

/* 底部导航 */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  background: rgba(255, 247, 250, 0.97);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tabbar a {
  flex: 1;
  min-height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  color: var(--text-3);
  font-size: 12px;
}
.tabbar a .ico { font-size: 19px; line-height: 1; }
.tabbar a.on { color: var(--brand); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border: none; border-radius: 24px;
  font-size: 15px; font-weight: 600;
  background: var(--card-2); color: var(--text);
}
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, #ffb0cf 0%, var(--brand-deep) 100%); color: #fff; }
.btn-gold { background: linear-gradient(135deg, #ffd88a, #eaa628); color: #3a2600; }
.btn-block { display: flex; width: 100%; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--text-2); }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* 标签 */
.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(247, 123, 167, .11);
  color: var(--brand);
  font-size: 11px; font-weight: 600;
}
.tag-free { background: rgba(31, 163, 106, .13); color: var(--green); }
.tag-vip { background: rgba(232, 147, 12, .14); color: var(--gold); }

/* 剧集卡片 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
}
.card { display: block; }
.poster {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(160deg, #ffe7f0, #fff9fc);
  display: flex; align-items: flex-end;
}
.poster .ph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 800;
  color: rgba(230, 130, 170, .30);
  letter-spacing: 2px;
}
.poster .t {
  position: relative;
  width: 100%;
  padding: 26px 10px 9px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .88));
  color: #fff;
  font-size: 13px; font-weight: 600;
  line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.poster .badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
}
.poster .cnt {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  padding: 2px 7px; border-radius: 6px;
  background: rgba(0, 0, 0, .6);
  font-size: 11px; color: #fff;
}
.card .meta { padding: 8px 2px 0; }
.card .meta .r1 { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.card .meta .hot { font-size: 12px; color: var(--text-3); }
.card .meta .price { font-size: 12px; color: var(--gold); font-weight: 600; }

/* ============ 播放页 ============ */

.stage {
  position: relative;
  width: 100%;
  background: #000;
  aspect-ratio: 9 / 16;
  max-height: 74vh;
  overflow: hidden;
}
.stage video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }

/* 未解锁的遮罩 */
.paywall {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: linear-gradient(rgba(0, 0, 0, .55), rgba(0, 0, 0, .88));
  backdrop-filter: blur(3px);
}
.paywall .lock { font-size: 44px; }
.paywall .txt { font-size: 15px; color: #fff; max-width: 300px; line-height: 1.55; }
.paywall .acts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.paywall .badge-lv {
  position: absolute; top: 12px; left: 12px;
  padding: 4px 10px; border-radius: 8px;
  background: rgba(255, 192, 67, .92); color: #3a2600;
  font-size: 12px; font-weight: 700;
}
.stage-foot {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.stage-foot .title { flex: 1; font-size: 14px; font-weight: 600; }
.stage-foot .title small { display: block; font-weight: 400; font-size: 12px; color: var(--text-3); }

/* 选集 */
.section { padding: 18px 16px 96px; max-width: 640px; margin: 0 auto; }
.section h2 {
  margin: 0 0 14px;
  font-size: 16px;
  display: flex; align-items: center; gap: 8px;
}
.section h2 .n { font-size: 12px; color: var(--text-3); font-weight: 400; }

.eps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
}
.ep {
  position: relative;
  min-height: 62px;
  padding: 9px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  overflow: hidden;
}
.ep .no { font-size: 14px; font-weight: 700; color: var(--text); }
.ep .lk { position: absolute; top: 5px; right: 6px; font-size: 11px; }
.ep.on { border-color: var(--brand); background: rgba(247, 123, 167, .09); }
.ep.done { border-color: rgba(63, 174, 124, .40); }
.ep.done .no { color: var(--green); }

/* 简介 */
.desc { color: var(--text-2); font-size: 14px; line-height: 1.75; margin: 0 0 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }

/* ============ 弹窗（底部抽屉） ============ */

.mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(120, 96, 108, .34);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg-soft);
  border-radius: 20px 20px 0 0;
  padding: 20px 18px;
  padding-bottom: calc(20px + var(--safe-b));
  animation: up .22s ease;
}
@keyframes up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet h3 { margin: 0 0 6px; font-size: 17px; }
.sheet .sub { color: var(--text-3); font-size: 13px; margin-bottom: 16px; }
.sheet .row {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px;
  padding: 12px 14px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: var(--card);
}
.sheet .row .ic { font-size: 22px; }
.sheet .row .nm { flex: 1; font-size: 15px; font-weight: 600; }
.sheet .row .ds { font-size: 12px; color: var(--text-3); font-weight: 400; }

.paybox { text-align: center; padding: 8px 0 4px; }
.paybox .amt { font-size: 34px; font-weight: 800; color: var(--gold); margin: 6px 0 2px; }
.paybox .amt span { font-size: 19px; }
.paybox .cur { font-size: 12px; color: var(--text-3); }
.paybox .warn {
  margin-top: 14px; padding: 9px 12px;
  border-radius: 9px;
  background: rgba(232, 147, 12, .10);
  color: var(--gold);
  font-size: 12px; text-align: left;
}

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 7px; }
.field input {
  width: 100%;
  min-height: 48px;
  /* ★ 16px 起：小于 16px 时 iOS 聚焦会自动放大页面 */
  font-size: 16px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
}
.field input:focus { outline: none; border-color: var(--brand); }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tabs button {
  flex: 1; min-height: 44px;
  border: none; border-radius: 11px;
  background: var(--card); color: var(--text-2);
  font-size: 15px; font-weight: 600;
}
.tabs button.on { background: rgba(247, 123, 167, .11); color: var(--brand); }
.err { color: var(--brand); font-size: 13px; min-height: 20px; margin: 4px 0 10px; }

/* 提示条 */
.toast {
  position: fixed; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 90;
  max-width: 78vw;
  padding: 12px 20px;
  border-radius: 12px;
  background: rgba(110, 88, 99, .92);
  color: #fff;
  border: 1px solid rgba(255,255,255,.14);
  font-size: 14px;
  text-align: center;
  line-height: 1.5;
}

/* 列表项 */
.rowlist { display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--card);
}
.item .th { width: 54px; height: 72px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(160deg, #ffe7f0, #fff9fc);
  display: flex; align-items: center; justify-content: center; font-size: 20px; color: rgba(230, 130, 170, .30); }
.item .info { flex: 1; min-width: 0; }
.item .info .t { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.item .info .s { font-size: 12px; color: var(--text-3); }
.item .go { color: var(--text-3); font-size: 13px; }

.stat {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-bottom: 18px;
}
.stat .box { padding: 14px 8px; border-radius: 12px; background: var(--card); text-align: center; }
.stat .box .v { font-size: 21px; font-weight: 800; color: var(--brand); }
.stat .box .k { font-size: 12px; color: var(--text-3); margin-top: 3px; }

.empty { text-align: center; padding: 50px 20px; color: var(--text-3); font-size: 14px; }
.empty .ic { font-size: 42px; display: block; margin-bottom: 12px; opacity: .5; }

.note {
  padding: 12px 14px; border-radius: 10px;
  background: rgba(232, 147, 12, .09);
  border: 1px solid rgba(232, 147, 12, .26);
  color: var(--gold); font-size: 12px; line-height: 1.6;
  margin-bottom: 16px;
}

/* ============ 后台 ============ */

.admin { max-width: 900px; margin: 0 auto; padding: 16px 16px 60px; }
.admin h2 { font-size: 15px; margin: 22px 0 12px; display: flex; align-items: center; gap: 8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--text-3); font-weight: 500; font-size: 12px; }
.tblwrap { overflow-x: auto; border-radius: 12px; background: var(--card); }
.tblwrap .tbl { min-width: 620px; }
.tblwrap .tbl { display: block; overflow-x: auto; }
.pill { padding: 2px 8px; border-radius: 20px; font-size: 11px; }
.pill.paid { background: rgba(53, 196, 139, .16); color: var(--green); }
.pill.pending { background: rgba(232, 147, 12, .14); color: var(--gold); }
.pill.cancelled { background: rgba(120, 130, 150, .16); color: var(--text-3); }

/* ============ 响应式：平板与桌面居中不拉伸 ============ */

@media (min-width: 700px) {
  .wrap, .section { max-width: 720px; }
  .stage { max-height: 72vh; border-radius: var(--radius); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}

@media (max-width: 340px) {
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { grid-template-columns: 1fr; }
}

/* ============ 支付结果页 ============ */

.pay-result {
  max-width: 420px;
  margin: 0 auto;
  padding: 38px 22px calc(38px + var(--safe-b));
  text-align: center;
}

.pay-ico {
  width: 68px; height: 68px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 700;
  background: var(--card-2);
  color: var(--text-2);
}
.pay-ico.ok   { background: rgba(31,163,106,.14); color: var(--green); }
.pay-ico.fail { background: rgba(236,63,124,.12);  color: var(--brand); }
.pay-ico.wait { background: rgba(232,147,12,.14); color: var(--gold); }

.pay-title { font-size: 20px; font-weight: 700; margin: 0 0 8px; }
.pay-desc  { font-size: 14px; color: var(--text-2); line-height: 1.6; margin: 0 0 22px; }

.pay-detail {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 16px;
  margin-bottom: 22px;
  text-align: left;
}
.pay-detail > div {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 12px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.pay-detail > div:last-child { border-bottom: 0; }
.pay-detail span { color: var(--text-3); flex-shrink: 0; }
.pay-detail b   { color: var(--text); font-weight: 600; word-break: break-all; text-align: right; }

.pay-result .btn { margin-top: 10px; }


/* ============ 模拟收银台 ============ */

.cashier {
  max-width: 420px;
  margin: 0 auto;
  padding: 20px 18px calc(24px + var(--safe-b));
}

.cashier-hd {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 22px;
}
.cashier-logo {
  font-size: 17px; font-weight: 800; letter-spacing: 1px;
  color: var(--brand);
}
.cashier-tip {
  font-size: 11px; color: var(--gold);
  background: rgba(232,147,12,.13);
  border: 1px solid rgba(232,147,12,.32);
  border-radius: 999px;
  padding: 4px 10px;
}

.cashier-amt {
  text-align: center;
  padding: 26px 0 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.cashier-amt-num {
  font-size: 38px; font-weight: 800; color: var(--text);
  letter-spacing: -1px; line-height: 1.2;
}
.cashier-amt-title {
  font-size: 13px; color: var(--text-2);
  margin-top: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.cashier-methods { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.cm {
  display: flex; align-items: center; gap: 12px;
  min-height: 50px;                 /* 移动端可点区域不小于 44px */
  padding: 0 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 15px; color: var(--text-2);
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.cm.active {
  border-color: var(--brand);
  background: rgba(236,63,124,.07);
  color: var(--text);
  font-weight: 600;
}
.cm-ico {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
}
.cm-ico.wechat { background: linear-gradient(135deg,#2aae67,#07c160); }
.cm-ico.alipay { background: linear-gradient(135deg,#3aa0ff,#1677ff); }

.cashier-note {
  margin-top: 18px;
  font-size: 12px; line-height: 1.75; color: var(--text-3);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.cashier-note b { color: var(--text-2); }


/* ============ 后台表单提示 ============ */

.field .hint,
.hint {
  font-size: 12px; line-height: 1.7; color: var(--text-3);
  background: var(--bg-soft);
  border-left: 3px solid var(--brand);
  border-radius: 0 8px 8px 0;
  padding: 10px 12px;
  margin: 4px 0 14px;
}


/* ============ 樱花粉主题增强：柔光 / 粉调阴影 / 描边 ============ */

body {
  background:
    radial-gradient(760px 400px at 50% -150px, rgba(255, 200, 222, .20), transparent 72%),
    var(--bg);
  background-attachment: fixed;
}

/* 卡片与缩略图：柔粉投影 */
.card .poster,
.item .th {
  border: 1px solid rgba(255, 233, 243, .95);
  box-shadow: 0 6px 18px rgba(240, 150, 185, .10);
}

/* 主按钮：粉雾光晕 */
.btn-primary { box-shadow: 0 6px 16px rgba(240, 150, 185, .22); }
.btn-primary:active { box-shadow: 0 3px 9px rgba(240, 150, 185, .18); }
.btn-gold { box-shadow: 0 5px 14px rgba(217, 154, 31, .20); }

/* 各类容器：淡粉描边 + 轻投影 */
.stat .box, .item, .sheet .row, .tblwrap, .cm, .pay-detail,
.cashier-note, .note, .ep {
  border: 1px solid var(--line);
  box-shadow: 0 3px 12px rgba(240, 150, 185, .05);
}
.stat .box, .item, .sheet .row, .cm, .pay-detail { background: var(--card); }

/* 表单输入：聚焦时粉光 */
.field input:focus { box-shadow: 0 0 0 3px rgba(247, 150, 190, .14); }

/* 底部导航：选中项加粉色高亮底 */
.tabbar a.on { background: linear-gradient(180deg, rgba(247,150,190,.10), transparent); }

/* 弹层顶部小圆角条，增加轻盈感 */
.sheet { box-shadow: 0 -8px 30px rgba(240, 150, 185, .12); }

/* toast 保持深底白字 */
.toast { box-shadow: 0 8px 24px rgba(110, 88, 99, .22); }
