/* kfbeta16 — single (trang anime + player)
   Dùng token chung từ main.css (--bg*, --text*, --accent*, --radius…) */

.skel {
    background: linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%);
    background-size: 200% 100%;
    border-radius: var(--r-sm);
    animation: kf-shimmer 1.4s infinite linear;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes zoomIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }

/* =====================================================================
   BỐ CỤC
   Mobile: xếp chồng · Desktop (≥1024px): ảnh bìa trái, tập phim + info phải
   ===================================================================== */
.page-wrap {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0;
}
.page-wrap > * { margin-bottom: 16px; }

@media (min-width: 1024px) {
    .page-wrap {
        display: grid;
        grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
        column-gap: 24px;
        align-items: start;
    }
    .page-wrap > * { grid-column: 1 / -1; }

    .page-wrap > .cover-card {
        grid-column: 1;
        grid-row: 2 / span 3;
        position: sticky;
        top: calc(var(--header-h) + 16px);
        width: 100%;
        max-width: none;
        margin: 0 0 16px;
    }
    .page-wrap > .ep-section     { grid-column: 2; grid-row: 2; }
    .page-wrap > .slide-container { grid-column: 2; grid-row: 3; }
    .page-wrap > .action-bar     { grid-column: 2; grid-row: 4; }

    /* Các khối còn lại: hàng cố định để giữ đúng thứ tự */
    .page-wrap > #player-wrap        { grid-row: 1; }
    .page-wrap > .related-section    { grid-row: 5; }
    .page-wrap > .review-section     { grid-row: 6; }
    .page-wrap > .my-rv-card         { grid-row: 7; }
    .page-wrap > .single-reviews     { grid-row: 8; }
    .page-wrap > .comments-section   { grid-row: 9; }

    /* Khi đang phát video: bỏ lưới, dàn full chiều rộng */
    body.is-playing .page-wrap { display: block; }
}

/* =====================================================================
   ẢNH BÌA + LIGHTBOX
   ===================================================================== */
.cover-card {
    position: relative;
    width: min(240px, 62vw);
    max-width: 100%;
    margin: 0 auto 16px;
    background: var(--bg2);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.cover-ratio { position: relative; aspect-ratio: var(--thumb-ratio); }
.cover-img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
    transition: transform .4s ease;
}
.cover-img:hover { transform: scale(1.02); }
.cover-skel { position: absolute; inset: 0; border-radius: 0; }
.cover-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: none;
    padding: 4px 10px;
    background: var(--accent);
    border-radius: var(--r-sm);
    color: var(--on-accent);
    font-size: var(--fs-xs);
    font-weight: 800;
    letter-spacing: .03em;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    margin: 0 !important;
    background: rgba(5, 6, 9, .95);
}
.lightbox.show { display: flex; }
.lightbox img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius);
    animation: zoomIn .22s ease;
}
.lightbox-close {
    position: absolute;
    top: 14px;
    right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--bg3);
    color: var(--text1);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}
.lightbox-close:hover { background: var(--accent); }

/* =====================================================================
   DANH SÁCH TẬP (trước khi phát)
   ===================================================================== */
.ep-section {
    display: none;
    background: var(--bg2);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.ep-section.show { display: block; }

.ep-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px;
    color: var(--text2);
    font-size: var(--fs);
}
.ep-spinner {
    width: 26px;
    height: 26px;
    margin: 0 auto;
    flex-shrink: 0;
    border: 3px solid var(--bg4);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
.ep-loading .ep-spinner { margin: 0; }

.ep-tabs {
    display: flex;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
}
.ep-tabs::-webkit-scrollbar { display: none; }
.ep-tab-btn {
    flex: 1 0 auto;
    margin-bottom: -1px;
    padding: 13px 14px;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--text2);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: color var(--tr), border-color var(--tr);
}
.ep-tab-btn:hover { color: var(--text1); }
.ep-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.ep-tab-content { display: none; padding: 14px; }
.ep-tab-content.active { display: block; }

.ep-controls { display: flex; gap: 8px; margin-bottom: 12px; }
.ep-search {
    flex: 1;
    min-width: 0;
    height: 38px;
    padding: 0 12px;
    background: var(--bg);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text1);
    font-family: var(--font);
    font-size: 13px;
}
.ep-search:focus { border-color: var(--accent); }

.ep-range-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 14px 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.ep-range-tabs::-webkit-scrollbar { display: none; }
.ep-range-btn {
    height: 30px;
    padding: 0 12px;
    background: var(--bg3);
    border: 0;
    border-radius: var(--r-pill);
    color: var(--text2);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color var(--tr), color var(--tr);
}
.ep-range-btn:hover:not(.active) { background: var(--bg4); color: var(--text1); }
.ep-range-btn.active { background: var(--accent); color: var(--on-accent); }

.ep-list,
.episode-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
    gap: 6px;
    max-height: 288px;
    margin: 0;
    padding: 0 4px 0 0;
    overflow-y: auto;
    list-style: none;
}
.ep-list li,
.episode-list li { list-style: none; }

.ep-list li a,
.episode-list li a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 38px;
    padding: 0 4px;
    background: var(--bg3);
    border: 0;
    border-radius: var(--r-sm);
    color: var(--text1);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color var(--tr), color var(--tr);
}
.ep-list li a:visited,
.episode-list li a:visited { background: var(--bg); color: var(--text3); }
.ep-list li a:hover,
.episode-list li a:hover { background: var(--accent-soft); color: var(--accent); }

.episode-list li.current-episode a,
.episode-list li.current-episode a:visited {
    background: var(--accent);
    color: var(--on-accent);
}

/* =====================================================================
   INFO / STORY (slide tabs)
   ===================================================================== */
.slide-container {
    background: var(--bg2);
    border-radius: var(--radius-lg);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}
.slide-nav {
    display: flex;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.slide-nav::-webkit-scrollbar { display: none; }
.slide-nav-btn {
    flex: 1;
    min-width: 72px;
    margin-bottom: -1px;
    padding: 14px 8px;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--text2);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    transition: color var(--tr), border-color var(--tr), background-color var(--tr);
}
.slide-nav-btn:hover { color: var(--text1); }
.slide-nav-btn:active { background: var(--bg3); }
.slide-nav-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.slide-panels-wrap {
    display: flex;
    will-change: transform;
    transition: transform .32s cubic-bezier(.4, 0, .2, 1);
    touch-action: pan-y;
}
.slide-panel {
    flex: 0 0 100%;
    min-width: 0;
    min-height: 160px;
    padding: 16px;
    user-select: text;
    -webkit-user-select: text;
}
@media (min-width: 768px) { .slide-panel { padding: 20px; } }

.slide-title {
    margin: 0 0 12px;
    color: var(--text1);
    font-size: clamp(18px, 2.4vw, 22px);
    font-weight: 800;
    line-height: 1.3;
}

.meta-list { margin: 0; padding: 0; list-style: none; }
.meta-list + .meta-list { margin-top: 12px; padding-top: 4px; border-top: 1px dashed var(--border2); }
.meta-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text1);
    font-size: var(--fs);
    word-break: break-word;
}
.meta-list li:last-child { border-bottom: 0; }

.label-tag {
    display: inline-block;
    flex-shrink: 0;
    min-width: 76px;
    margin-right: 4px;
    padding: 0;
    background: none;
    border: 0;
    color: var(--text3);
    font-size: var(--fs-xs);
    font-weight: 800;
    letter-spacing: .08em;
    text-align: left;
    text-transform: uppercase;
}

.slide-container a { color: var(--accent2); text-decoration: none; }
.slide-container a:hover { color: var(--text1); }

.tag-chip {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg3);
    border: 0;
    border-radius: var(--r-pill);
    color: var(--text2) !important;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    text-decoration: none !important;
    transition: background-color var(--tr), color var(--tr);
}
.tag-chip:hover { background: var(--accent); color: var(--on-accent) !important; }

.section-heading {
    margin: 0 0 12px;
    padding-left: 10px;
    border-left: 3px solid var(--accent);
    color: var(--text3);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

/* =====================================================================
   NÚT YÊU THÍCH
   ===================================================================== */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0;
    border: 0;
}
.action-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    padding: 0 18px;
    background: var(--bg3);
    border: 0;
    border-radius: var(--radius);
    color: var(--text1);
    font-family: var(--font);
    font-size: var(--fs);
    font-weight: 700;
    cursor: pointer;
    transition: background-color var(--tr), color var(--tr);
}
.action-btn:hover { background: var(--bg4); }
.action-btn svg { width: 20px; height: 20px; }
#btn-fav:hover { color: var(--accent3); }
#btn-fav.active { background: var(--accent3); color: #fff; }
#btn-fav.active svg { fill: #fff; stroke: #fff; }

/* =====================================================================
   LIÊN QUAN (series)
   ===================================================================== */
.related-section {
    padding: 16px;
    background: var(--bg2);
    border-radius: var(--radius-lg);
}
.related-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    padding: 0;
    border: 0;
    color: var(--text1);
    font-size: var(--fs-lg);
    font-weight: 800;
}
.related-header::before {
    content: "";
    width: 4px;
    height: 1.1em;
    border-radius: 2px;
    background: var(--accent);
}

.rel-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
    overflow-x: auto;
    scrollbar-width: none;
}
.rel-tabs:empty { display: none; }
.rel-tabs::-webkit-scrollbar { display: none; }
.rel-tab-btn {
    height: 32px;
    padding: 0 14px;
    background: var(--bg3);
    border: 0;
    border-radius: var(--r-pill);
    color: var(--text2);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color var(--tr), color var(--tr);
}
.rel-tab-btn:hover:not(.active) { background: var(--bg4); color: var(--text1); }
.rel-tab-btn.active { background: var(--accent); color: var(--on-accent); }
.rel-tab-content { display: none; }
.rel-tab-content.active { display: block; }

.rel-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 10px;
}
@media (min-width: 560px)  { .rel-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px)  { .rel-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.rel-item {
    min-width: 0;
    background: var(--bg3);
    border-radius: var(--radius);
    overflow: hidden;
    transition: background-color var(--tr);
}
.rel-item:hover { background: var(--bg4); }
.rel-item a { display: block; color: inherit !important; text-decoration: none; }
.rel-thumb { position: relative; aspect-ratio: var(--thumb-ratio); background: var(--bg4); overflow: hidden; }
.rel-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.rel-item:hover .rel-thumb img { transform: scale(1.05); }
.rel-noti {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 7px;
    background: var(--accent);
    border-radius: var(--r-sm);
    color: var(--on-accent);
    font-size: 10px;
    font-weight: 800;
}
.rel-info { padding: 9px 10px 11px; }
.rel-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    min-height: calc(1.4em * 2);
    margin: 0 0 4px;
    color: var(--text1);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    overflow: hidden;
    transition: color var(--tr);
}
.rel-item:hover .rel-name { color: var(--accent); }
.rel-meta { color: var(--text3); font-size: var(--fs-xs); }

.btn-show-more {
    display: block;
    width: 100%;
    height: 42px;
    margin-top: 14px;
    background: var(--bg3);
    border: 0;
    border-radius: var(--radius);
    color: var(--accent2);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: background-color var(--tr), color var(--tr);
}
.btn-show-more:hover { background: var(--bg4); color: var(--text1); }

/* =====================================================================
   TOAST (single)
   ===================================================================== */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--mnav-h) + 24px + env(safe-area-inset-bottom));
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: calc(100% - 32px);
    margin: 0 !important;
    padding: 12px 20px;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-left: 4px solid var(--accent2);
    border-radius: var(--radius);
    color: var(--text1);
    font-size: var(--fs);
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 20px);
    transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.success .toast-icon { color: var(--green); }
.toast.error .toast-icon   { color: var(--red); }
.toast-icon { font-size: 1.1em; }

/* =====================================================================
   ĐÁNH GIÁ
   ===================================================================== */
.review-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg2);
    border-radius: var(--radius-lg);
}
.review-stats { display: flex; align-items: center; gap: 12px; }
.avg-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    background: var(--yellow);
    border-radius: var(--radius);
    color: #1a1300;
    font-size: 19px;
    font-weight: 800;
}
.rv-label { color: var(--text1); font-size: var(--fs); font-weight: 700; }
.rv-count { color: var(--text2); font-size: 12px; }
.btn-rate {
    height: 40px;
    padding: 0 16px;
    background: var(--accent-soft);
    border: 0;
    border-radius: var(--radius);
    color: var(--accent);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color var(--tr), color var(--tr);
}
.btn-rate:hover { background: var(--accent); color: var(--on-accent); }

.my-rv-card {
    padding: 14px 16px;
    background: var(--bg2);
    border: 0;
    border-left: 4px solid var(--accent2);
    border-radius: var(--radius-lg);
}
.my-rv-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; color: var(--text2); font-size: 12px; }
.my-rv-label { color: var(--accent2); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.my-rv-body { display: flex; align-items: flex-start; gap: 12px; }
.my-rv-score {
    flex-shrink: 0;
    padding: 4px 10px;
    background: var(--yellow);
    border-radius: var(--r-sm);
    color: #1a1300;
    font-size: 15px;
    font-weight: 800;
}
.my-rv-text { color: var(--text1); font-size: 13px; line-height: 1.6; word-break: break-word; }
.my-rv-foot { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border2); font-size: 12px; text-align: right; }

/* Modal đánh giá */
.rv-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    padding: 16px;
    background: rgba(5, 6, 9, .82);
}
.rv-modal.show { display: flex; }
.rv-modal-box {
    width: 100%;
    max-width: 400px;
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transform: translateY(16px);
    transition: transform .25s ease;
}
.rv-modal.show .rv-modal-box { transform: translateY(0); }
.rv-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg3);
    border-bottom: 1px solid var(--border);
}
.rv-modal-head h3 { margin: 0; color: var(--text1); font-size: var(--fs-md); }
.rv-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: none;
    border: 0;
    border-radius: var(--r-sm);
    color: var(--text2);
    font-size: 24px;
    cursor: pointer;
}
.rv-close:hover { background: var(--bg4); color: var(--text1); }
.rv-modal-body { padding: 20px; text-align: center; }
.rv-slider-val { display: block; color: var(--yellow); font-size: 48px; font-weight: 800; line-height: 1.1; }
#rv-slider { width: 100%; margin: 12px 0; accent-color: var(--yellow); cursor: pointer; }
.rv-stars { color: var(--yellow); letter-spacing: 3px; }
.rv-textarea {
    display: block;
    width: 100%;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text1);
    font-family: var(--font);
    font-size: 13px;
    resize: none;
}
.rv-textarea:focus { border-color: var(--accent); }
.btn-submit-rv {
    width: 100%;
    height: 46px;
    background: var(--yellow);
    border: 0;
    border-radius: var(--radius);
    color: #1a1300;
    font-family: var(--font);
    font-size: var(--fs-md);
    font-weight: 800;
    cursor: pointer;
    transition: filter var(--tr);
}
.btn-submit-rv:hover { filter: brightness(1.08); }
.btn-submit-rv:disabled { opacity: .6; }

/* Danh sách đánh giá */
.single-reviews,
.comments-section {
    padding: 16px;
    background: var(--bg2);
    border-radius: var(--radius-lg);
}
@media (min-width: 768px) {
    .single-reviews, .comments-section, .related-section { padding: 20px; }
}

.srv-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.srv-head h3 { margin: 0; color: var(--text1); font-size: var(--fs-lg); font-weight: 800; white-space: nowrap; }
.srv-head-line { flex: 1; height: 1px; background: var(--border); }

.srv-item {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.srv-item:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.srv-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: var(--bg4);
    border-radius: 50%;
    overflow: hidden;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
}
.srv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.srv-body { flex: 1; min-width: 0; }
.srv-user-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.srv-name { color: var(--text1); font-size: 13px; font-weight: 700; }
.srv-date { color: var(--text3); font-size: var(--fs-xs); white-space: nowrap; }
.srv-badge {
    display: inline-block;
    margin-bottom: 6px;
    padding: 2px 8px;
    border: 0;
    border-radius: var(--r-sm);
    font-size: var(--fs-xs);
    font-weight: 800;
}
.score-high { background: rgba(52, 211, 153, .15); color: var(--green); }
.score-mid  { background: rgba(251, 191, 36, .15); color: var(--yellow); }
.score-low  { background: rgba(248, 87, 107, .15); color: var(--red); }
.srv-text { color: var(--text2); font-size: 13px; line-height: 1.6; word-break: break-word; }
.srv-skel { height: 72px; margin-bottom: 12px; border-radius: var(--radius); }

.btn-srv-more,
.btn-load-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 22px;
    background: var(--bg3);
    border: 0;
    border-radius: var(--r-pill);
    color: var(--accent2);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color var(--tr), color var(--tr);
}
.btn-srv-more:hover,
.btn-load-more:hover { background: var(--bg4); color: var(--text1); }
.btn-srv-more:disabled { opacity: .5; cursor: not-allowed; }

/* =====================================================================
   BÌNH LUẬN
   ===================================================================== */
.cmt-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    color: var(--text1);
    font-size: var(--fs-lg);
    font-weight: 800;
}
.cmt-count {
    padding: 1px 9px;
    background: var(--bg3);
    border-radius: var(--r-pill);
    color: var(--text2);
    font-size: 12px;
    font-weight: 700;
}

.cmt-input-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 20px; }
.cmt-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: var(--bg4);
    border-radius: 50%;
    overflow: hidden;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}
.cmt-avatar img { width: 100%; height: 100%; object-fit: cover; }

.cmt-input-box {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    min-width: 0;
    padding: 9px 12px;
    background: var(--bg);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    transition: border-color var(--tr);
}
.cmt-input-box:focus-within { border-color: var(--accent); }
.cmt-input-box textarea {
    flex: 1;
    min-width: 0;
    min-height: 22px;
    padding: 1px 0;
    background: transparent;
    border: 0;
    color: var(--text1);
    font-family: var(--font);
    font-size: 13px;
    line-height: 20px;
    resize: none;
}
.btn-send {
    display: flex;
    padding: 2px;
    background: transparent;
    border: 0;
    border-radius: var(--r-sm);
    color: var(--accent);
    cursor: pointer;
}
.btn-send:hover { color: var(--accent-hover); }
.btn-send:disabled { opacity: .5; }
.btn-send svg { width: 22px; height: 22px; }

.cmt-list { margin-top: 14px; }
.cmt-item { display: flex; gap: 12px; margin-bottom: 18px; }
.cmt-body { flex: 1; min-width: 0; }
.cmt-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; color: var(--text3); font-size: 12px; }
.cmt-user { color: var(--text1); font-size: 13px; font-weight: 700; }
.cmt-text { margin-bottom: 8px; color: var(--text2); font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.cmt-footer { display: flex; align-items: center; gap: 6px; }

.cmt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 46px;
    height: 30px;
    padding: 0 10px;
    background: var(--bg3);
    border: 0;
    border-radius: var(--r-pill);
    color: var(--text2);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--tr), color var(--tr);
}
.cmt-btn:hover { background: var(--bg4); color: var(--text1); }
.cmt-btn svg { width: 15px; height: 15px; fill: transparent; stroke: currentColor; stroke-width: 2; }
.active-like    { background: rgba(78, 168, 255, .15) !important; color: var(--blue) !important; }
.active-like svg { fill: var(--blue); stroke: none !important; }
.active-dislike { background: rgba(248, 87, 107, .15) !important; color: var(--red) !important; }
.active-dislike svg { fill: var(--red); stroke: none !important; }

.btn-reply {
    height: 30px;
    padding: 0 10px;
    background: transparent;
    border: 0;
    border-radius: var(--r-pill);
    color: var(--text3);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.btn-reply:hover { background: var(--bg3); color: var(--text1); }

.reply-list { margin-top: 12px; padding-left: 14px; border-left: 2px solid var(--border2); }
.reply-box { display: none; margin-top: 10px; margin-bottom: 0; }

.mini-spinner {
    display: none;
    width: 13px;
    height: 13px;
    border: 2px solid var(--accent2);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

.cmt-toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--mnav-h) + 24px + env(safe-area-inset-bottom));
    z-index: 99999;
    max-width: calc(100% - 32px);
    margin: 0 !important;
    padding: 11px 20px;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-left: 4px solid var(--accent2);
    border-radius: var(--radius);
    color: var(--text1);
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 20px);
    transition: opacity .25s ease, transform .25s ease;
}
.cmt-toast.show { opacity: 1; transform: translate(-50%, 0); }
.cmt-toast.error   { border-left-color: var(--red); }
.cmt-toast.success { border-left-color: var(--green); }

/* =====================================================================
   PLAYER
   ===================================================================== */
#player-wrap { margin-bottom: 16px; }

/* Ẩn ảnh bìa + danh sách tập khi đang phát */
body.is-playing .cover-card,
body.is-playing .ep-section { display: none !important; }

.video-wrapper {
    position: relative;
    height: 0;
    padding-bottom: 56.25%;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.video-wrapper::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid rgba(255, 255, 255, .15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    border: 0;
}
@media (max-width: 599px) {
    /* Video tràn sát mép màn hình trên điện thoại */
    #player-wrap .video-wrapper,
    #player-wrap .skeleton-video {
        margin-left: calc(var(--gutter) * -1);
        margin-right: calc(var(--gutter) * -1);
        border-radius: 0;
    }
}

.video-server-selection {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 12px 0 0;
    padding: 10px;
    background: var(--bg2);
    border: 0;
    border-radius: var(--radius);
}
.video-server-selection span { color: var(--text2); font-size: 12px; font-weight: 700; }
.video-server-button {
    height: 32px;
    padding: 0 12px;
    background: var(--bg3);
    border: 0;
    border-radius: var(--r-sm);
    color: var(--text1);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--tr);
}
.video-server-button:hover { background: var(--bg4); }
.video-server-button.active { background: var(--accent); color: var(--on-accent); font-weight: 800; }

.episode-title-bar {
    margin: 14px 0 10px;
    color: var(--text1);
    font-size: var(--fs-md);
    font-weight: 700;
    line-height: 1.4;
}

.player-nav {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 8px;
    margin: 10px 0 16px;
}
.nav-button {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    min-height: 48px;
    padding: 6px 12px;
    background: var(--bg3);
    border: 0;
    border-radius: var(--radius);
    color: var(--text1) !important;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color var(--tr);
}
.nav-button:not(.disabled):hover { background: var(--bg4); }
.nav-button.list-ep {
    flex: 0 0 auto;
    justify-content: center;
    background: var(--accent);
    color: var(--on-accent) !important;
}
.nav-button.list-ep:hover { background: var(--accent-hover) !important; }
.nav-button.disabled { background: var(--bg2); color: var(--text3) !important; cursor: not-allowed; }
.nav-button .nav-arrow { flex-shrink: 0; font-size: 1.1em; }
.nav-button .nav-label { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; overflow: hidden; }
.nav-button.prev-ep .nav-label { text-align: left; }
.nav-button.next-ep { justify-content: flex-end; }
.nav-button.next-ep .nav-label { text-align: right; }
.nav-button .nav-label em {
    max-width: 160px;
    color: var(--accent2);
    font-size: .8em;
    font-style: normal;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tabs-container {
    padding: 14px;
    background: var(--bg2);
    border: 0;
    border-radius: var(--radius-lg);
}
.tab-buttons {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
}
.tab-buttons::-webkit-scrollbar { display: none; }
.tab-button {
    flex-shrink: 0;
    margin-bottom: -1px;
    padding: 9px 14px;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--text2);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: color var(--tr), border-color var(--tr);
}
.tab-button:hover { color: var(--text1); }
.tab-button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 800; }
.tab-content { display: none; padding-top: 12px; }
.tab-content.active { display: block; }

.episode-controls { display: flex; gap: 8px; margin-bottom: 10px; }
.episode-search {
    flex: 1;
    min-width: 0;
    height: 36px;
    padding: 0 12px;
    background: var(--bg);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text1);
    font-family: var(--font);
    font-size: 13px;
}
.episode-search:focus { border-color: var(--accent); }
.sort-button {
    height: 36px;
    padding: 0 12px;
    background: var(--bg3);
    border: 0;
    border-radius: var(--radius);
    color: var(--text2);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}
.sort-button:hover { background: var(--bg4); color: var(--text1); }
.episode-list { max-height: 248px; }

.skeleton-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%);
    background-size: 200% 100%;
    border-radius: var(--radius-lg);
    animation: kf-shimmer 1.4s infinite linear;
}
.player-loading { padding: 20px; color: var(--text2); font-size: 13px; text-align: center; }
.player-error {
    padding: 28px;
    background: var(--bg2);
    border: 1px dashed var(--border2);
    border-radius: var(--radius-lg);
    text-align: center;
}
.player-error p { margin: 0; color: var(--red); font-weight: 700; }

@media (max-width: 480px) {
    .nav-button { padding: 6px 10px; font-size: 12px; }
    .nav-button .nav-label em { max-width: 90px; }
    .review-section { flex-wrap: wrap; }
    .btn-rate { flex: 1; }
}
