/* =====================================================================
   短剧 H5 前台样式：移动端优先（竖屏），PC 端居中做简单适配
   ===================================================================== */

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

html, body {
    background: #f5f5f7;
    color: #222;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; }
img { display: block; width: 100%; }

/* 页面主体：手机上满宽，PC 上居中限宽 */
.app { max-width: 540px; margin: 0 auto; min-height: 100vh; background: #fff; }

/* ---------------- 顶部导航 ---------------- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #eee;
}
.topbar .logo { font-size: 18px; font-weight: bold; color: #ff5a5f; }
.topnav { display: flex; align-items: center; gap: 14px; font-size: 14px; color: #555; }
.topnav .username { color: #ff5a5f; }
.topnav .btn-link { color: #ff5a5f; font-weight: bold; }

.content { padding: 12px 14px 24px; }
.footer { text-align: center; color: #aaa; font-size: 12px; padding: 18px 0; }

.section-title { font-size: 16px; font-weight: bold; margin: 14px 2px 12px; }
.empty { text-align: center; color: #999; padding: 60px 0; }

/* ---------------- 首页短剧卡片列表 ---------------- */
.drama-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.drama-card {
    width: calc(50% - 6px);
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.drama-card .cover { position: relative; aspect-ratio: 3 / 4; background: #eee; }
.drama-card .cover img { height: 100%; object-fit: cover; }
.price-tag {
    position: absolute; left: 6px; bottom: 6px;
    background: rgba(255,90,95,.92); color: #fff;
    font-size: 11px; padding: 2px 8px; border-radius: 20px;
}
.drama-card .info { padding: 8px 10px 10px; }
.drama-card .title {
    font-size: 15px; font-weight: bold; margin-bottom: 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drama-card .desc {
    color: #888; font-size: 12px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------------- 短剧详情页头部 ---------------- */
.drama-header { display: flex; gap: 14px; padding: 4px 2px 14px; }
.drama-cover {
    flex: 0 0 110px; width: 110px; border-radius: 8px; overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.drama-cover img { aspect-ratio: 3/4; object-fit: cover; }
.drama-meta { flex: 1; min-width: 0; }
.drama-title { font-size: 19px; margin-bottom: 6px; }
.drama-desc {
    color: #666; font-size: 13px; margin-bottom: 10px;
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.drama-price-box { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.drama-price { color: #ff5a5f; font-size: 22px; font-weight: bold; }
.badge-bought { color: #22a06b; font-size: 12px; border: 1px solid #22a06b; padding: 2px 8px; border-radius: 20px; }
.badge-tip { color: #ff5a5f; font-size: 11px; }

/* ---------------- 集数按钮列表 ---------------- */
.ep-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.ep-btn {
    position: relative;
    border: none;
    aspect-ratio: 1.6 / 1;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
}
.ep-free { background: #f0f2f5; color: #333; display: flex; align-items: center; justify-content: center; }
.ep-free:active { background: #e2e6ea; }
.ep-locked { background: linear-gradient(135deg, #444, #222); color: #f5c26b; }
.ep-locked .lock-icon { font-size: 11px; margin-right: 2px; vertical-align: middle; }

/* ---------------- 登录/注册表单 ---------------- */
.form-card {
    background: #fff; border-radius: 12px; padding: 24px 18px; margin-top: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,.05);
}
.form-card h2 { font-size: 20px; margin-bottom: 18px; text-align: center; }
.form-item { margin-bottom: 16px; }
.form-item label { display: block; font-size: 13px; color: #666; margin-bottom: 6px; }
.form-item input {
    width: 100%; height: 44px; border: 1px solid #ddd; border-radius: 8px;
    padding: 0 12px; font-size: 15px; background: #fafafa;
}
.form-item input:focus { outline: none; border-color: #ff5a5f; background: #fff; }
.form-error {
    background: #fff1f0; color: #d4380d; border: 1px solid #ffccc7;
    padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px;
}
.form-foot { text-align: center; margin-top: 14px; color: #888; font-size: 13px; }
.form-foot a { color: #ff5a5f; }

.btn-primary {
    display: inline-block; background: #ff5a5f; color: #fff !important;
    border: none; border-radius: 8px; height: 44px; line-height: 44px;
    padding: 0 20px; font-size: 15px; cursor: pointer; text-align: center;
}
.btn-block { display: block; width: 100%; }
.btn-primary:active { opacity: .88; }

/* ---------------- 播放器 ---------------- */
.player-wrap {
    margin: 0 -14px; background: #000;
    /* 竖屏短剧播放区域，16:9 横版播放器占满屏宽 */
}
.video-player { width: 100%; max-height: 70vh; display: block; background: #000; }
.player-info { padding: 14px 2px 4px; }
.player-info h2 { font-size: 17px; margin-bottom: 8px; }
.back-link { color: #ff5a5f; font-size: 14px; }
.episode-switch { display: flex; justify-content: space-between; margin-top: 18px; }
.switch-btn {
    background: #f0f2f5; border-radius: 8px; padding: 10px 18px;
    font-size: 14px; color: #333;
}

/* 无权限提示（播放页服务端拦截后展示） */
.lock-tip { text-align: center; padding: 70px 24px; }
.lock-icon-big { font-size: 56px; margin-bottom: 14px; }
.lock-tip h2 { font-size: 18px; margin-bottom: 10px; }
.lock-tip p { color: #888; font-size: 14px; margin-bottom: 22px; }

/* ---------------- PayMeGate 支付弹窗 ---------------- */
.pay-mask {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(0,0,0,.55);
    display: flex; align-items: flex-end; justify-content: center;
}
.pay-modal {
    position: relative;
    width: 100%; max-width: 540px;
    background: #fff;
    border-radius: 18px 18px 0 0;
    padding: 24px 20px 28px;
    animation: slideUp .22s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.pay-close {
    position: absolute; right: 14px; top: 10px;
    border: none; background: none; font-size: 28px; line-height: 1;
    color: #999; cursor: pointer;
}
.pay-title { font-size: 19px; font-weight: bold; text-align: center; }
.pay-sub { text-align: center; color: #888; font-size: 13px; margin-top: 4px; }
.pay-amount { text-align: center; margin: 16px 0 20px; color: #ff5a5f; }
.pay-amount .cur { font-size: 16px; vertical-align: top; margin-right: 4px; }
.pay-amount .amt { font-size: 38px; font-weight: bold; }

.pay-safe {
    background: #f6f8ff; border: 1px solid #dce3ff; border-radius: 10px;
    padding: 14px; color: #445; font-size: 13px; line-height: 1.8; text-align: center;
}
.card-errors { color: #d4380d; font-size: 13px; min-height: 20px; margin-top: 8px; }
.btn-pay {
    width: 100%; height: 48px; border: none; border-radius: 24px;
    background: linear-gradient(90deg, #ff7a59, #ff3d3d);
    color: #fff; font-size: 16px; font-weight: bold; cursor: pointer;
}
.btn-pay:disabled { opacity: .6; cursor: not-allowed; }
.pay-note { text-align: center; color: #aaa; font-size: 12px; margin-top: 12px; }
.pay-login-tip { text-align: center; color: #555; font-size: 14px; line-height: 2; padding: 10px 0 18px; }

/* 轻提示 toast */
.toast {
    position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
    z-index: 200; background: rgba(0,0,0,.82); color: #fff;
    padding: 10px 20px; border-radius: 22px; font-size: 14px;
    max-width: 86%; text-align: center;
}

/* ---------------- 支付结果返回页 ---------------- */
.result-box { text-align: center; padding: 56px 24px; }
.result-icon { font-size: 60px; margin-bottom: 14px; }
.result-box h2 { font-size: 19px; margin-bottom: 10px; }
.result-box p { color: #888; font-size: 14px; line-height: 1.8; margin-bottom: 22px; }
.result-box .back-link { display: inline-block; margin-top: 16px; color: #ff5a5f; font-size: 14px; }
.recheck-msg { color: #d48806; font-size: 13px; margin-top: 12px; min-height: 20px; }

/* 等待转圈动画 */
.spinner {
    width: 46px; height: 46px; margin: 0 auto 18px;
    border: 4px solid #eee; border-top-color: #ff5a5f; border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- PC 简单适配 ---------------- */
@media (min-width: 541px) {
    body { background: #eceef1; }
    .pay-modal { border-radius: 18px; margin-bottom: 6vh; }
}

/* ---------------- 简繁语言切换链接 ---------------- */
.lang-link {
    display: inline-block;
    padding: 3px 10px;
    margin-right: 6px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 20px;
    color: #fff;
    font-size: 12px;
    line-height: 1.6;
    text-decoration: none;
}
.lang-link:hover { background: rgba(255, 255, 255, 0.15); }
