/* ==========================================================================
   btf.cx —— 右下角浮动工具条扩展：帮我挑一部 / 历史观看记录
   --------------------------------------------------------------------------
   类名统一 btk- 前缀，且全名刻意避开 ad / ads / banner / popup / modal /
   overlay / sponsor / promo 等广告拦截黑名单子串，配合 JS 里「点击时才建
   DOM」的策略，避免被去广告插件与安全卫士误伤。
   桌面：居中卡片弹窗；移动端（<=768px）：从底部滑出的抽屉。
   ========================================================================== */

/* ---- 浮动条上的两颗新按钮：跟主题 .toolbar .btn 同款，只补图标颜色 ---- */
#btk-pick svg,
#btk-seen svg {
    display: block;
    width: 18px;
    height: 18px;
    color: #fff;
}

/* 浮条按钮的竖向间距放大到初始的 6 倍（主题原本 .toolbar .btn 是 margin-bottom:5px） */
#toolbar .btn { margin-bottom: 30px; }

/* 「回到顶部」的显隐改由 kit.js 判定：滚到离页底只剩五分之一才出现。
   主题 common.js 用的是 scrollTop > 500 就 .show()，长页面刚滑一下就冒出来；
   它设的是行内 display，这里用 !important 压住，两边不会互相打架
   （点一下滚回顶部的行为仍是主题原有的）。 */
#toolbar #totop { display: none !important; }
#toolbar #totop.btk-totop-show { display: block !important; }

body.btk-lock { overflow: hidden; }

/* ---- 遮罩 ---- */
.btk-veil {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, .55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity .22s ease;
}

.btk-veil.btk-on { opacity: 1; }

/* ---- 面板 ---- */
.btk-sheet {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 420px;
    max-height: 82vh;
    overflow: hidden;
    background: #fff;
    color: #333;
    border-radius: 14px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, .28);
    opacity: 0;
    transform: translateY(14px) scale(.97);
    transition: transform .24s cubic-bezier(.2, .8, .3, 1), opacity .22s ease;
}

.btk-veil.btk-on .btk-sheet {
    opacity: 1;
    transform: none;
}

.btk-top {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, .07);
}

.btk-h {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}

.btk-x {
    padding: 0 2px;
    border: 0;
    background: none;
    color: #999;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.btk-x:hover { color: #333; }

.btk-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px 16px 16px;
}

.btk-tip {
    margin: 18px 0;
    color: #888;
    font-size: 14px;
    text-align: center;
}

/* 提示语下面的「再试一次」也跟着居中 */
.btk-tip + .btk-acts { text-align: center; }

/* ---- 帮我挑一部：单片卡 ---- */
.btk-card { display: flex; }

.btk-pic {
    flex: 0 0 auto;
    display: block;
    width: 104px;
    height: 150px;
    margin-right: 12px;
    overflow: hidden;
    border-radius: 8px;
    background: #f2f2f2;
}

.btk-pic img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btk-main { flex: 1 1 auto; min-width: 0; }

.btk-name {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
}

.btk-name a { color: #222; text-decoration: none; }
.btk-name a:hover { color: #009A61; }

.btk-meta {
    margin: 0 0 6px;
    color: #888;
    font-size: 12px;
    line-height: 1.5;
}

.btk-cast {
    margin: 0 0 6px;
    color: #999;
    font-size: 12px;
    line-height: 1.5;
}

.btk-sum {
    margin: 0 0 10px;
    color: #666;
    font-size: 13px;
    line-height: 1.6;
}

.btk-acts { margin: 12px 0 0; }

.btk-go,
.btk-again,
.btk-blank {
    display: inline-block;
    padding: 8px 18px;
    border: 0;
    border-radius: 100px;
    font-size: 13px;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.btk-go {
    margin-right: 8px;
    background: #009A61;
    color: #fff;
}

.btk-go:hover { background: #008753; color: #fff; }

.btk-again,
.btk-blank {
    background: #f0f0f0;
    color: #555;
}

.btk-again:hover,
.btk-blank:hover { background: #e6e6e6; }

.btk-nopic {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #bbb;
    font-size: 12px;
}

/* ---- 历史观看记录：列表 ---- */
.btk-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.btk-item { margin-bottom: 10px; }

.btk-item a {
    display: flex;
    align-items: center;
    padding: 6px;
    border-radius: 8px;
    text-decoration: none;
}

.btk-item a:hover { background: #f7f7f7; }

.btk-thumb {
    flex: 0 0 auto;
    width: 52px;
    height: 72px;
    margin-right: 10px;
    overflow: hidden;
    border-radius: 6px;
    background: #f2f2f2;
    object-fit: cover;
}

.btk-tx { flex: 1 1 auto; min-width: 0; }

.btk-tx b {
    display: -webkit-box;
    margin-bottom: 6px;
    overflow: hidden;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    text-overflow: ellipsis;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.btk-tx i {
    color: #aaa;
    font-size: 12px;
    font-style: normal;
}

/* ---- 暗色模式（跟随主题的 data-theme 开关） ---- */
[data-theme='dark'] .btk-sheet { background: #1e2124; color: #d8d8d8; }
[data-theme='dark'] .btk-top { border-bottom-color: rgba(255, 255, 255, .09); }
[data-theme='dark'] .btk-name a { color: #e8e8e8; }
[data-theme='dark'] .btk-sum { color: #a8a8a8; }
[data-theme='dark'] .btk-again,
[data-theme='dark'] .btk-blank { background: #2c3034; color: #c8c8c8; }
[data-theme='dark'] .btk-item a:hover { background: #262a2e; }
[data-theme='dark'] .btk-tx b { color: #e0e0e0; }
[data-theme='dark'] .btk-pic,
[data-theme='dark'] .btk-thumb { background: #2a2e32; }

/* ---- 移动端自适应 ---- */
@media screen and (max-width: 768px) {
    /* 浮条按钮收窄一点，四颗竖排不至于太占屏幕 */
    #toolbar .btn {
        padding: 8px;
        margin-bottom: 30px;
        line-height: 16px;
    }

    #btk-pick svg,
    #btk-seen svg {
        width: 16px;
        height: 16px;
    }

    /* 弹层改成从底部滑出的抽屉，更符合手机操作习惯 */
    .btk-veil {
        align-items: flex-end;
        padding: 0;
    }

    .btk-sheet {
        max-width: 100%;
        max-height: 86vh;
        border-radius: 14px 14px 0 0;
        transform: translateY(100%);
    }

    .btk-pic {
        width: 92px;
        height: 132px;
    }
}

@media screen and (max-width: 360px) {
    .btk-pic { width: 80px; height: 116px; margin-right: 10px; }
    .btk-name { font-size: 15px; }
}
