@media screen and (max-width: 640px) {
    .box-player {
        position: relative;
        z-index: 10;
        clear: both;
        height: 60vh;
    }

    #player {
        position: relative;
        height: 100%;
    }
}

.pagination {
    display: block;
    width: 100%;
    text-align: center;
}

.pagination ul {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding-left: 0;
    margin: 20px auto;
}

.pagination ul li {
    margin: 0;
}

.main-menu .menu-item > a::after {
    content: none;
}

.list-films.film-new .item .name {
    display: flex;
    align-items: center;
    justify-content: center;
}

.list-films.film-new .item .name-title {
    width: 100%;
}

/* Owl already sizes each slot; the card must fill that slot at every breakpoint. */
.list-films #film_related .owl-item .item,
.list-films #film_hot .owl-item .item {
    float: none;
    width: calc(100% - 8px);
    height: auto;
    margin: 0 4px;
}

.list-films #film_related .item .img-film,
.list-films #film_hot .item .img-film {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
}

.list-films #film_related .item .text a,
.list-films #film_hot .item .text a {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.home-genre-more {
    clear: both;
    margin: 12px 0 0;
    text-align: center;
}

.home-genre-more-link {
    display: inline-block;
    padding: 7px 14px;
    border: 1px solid #4c4c4c;
    border-radius: 4px;
    background: #252b35;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.home-genre-more-link:hover,
.home-genre-more-link:focus {
    border-color: #da966e;
    color: #da966e;
}

/* HentaiSub retains the original Fanxxx layout; only movie media is portrait. */
.list-films.film-new .item {
    height: auto !important;
}
.list-films .item > a {
    display: block;
    position: relative;
}
.list-films .item .img-film,
.list-films.film-hot .item .img-film,
.list-films #film_hot .item .img-film,
.list-films #film_related .item .img-film {
    display: block;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 2 / 3;
    object-fit: cover;
}
.list-film .film-item-ver img.avatar {
    width: 66.6667px;
    height: 100px;
    aspect-ratio: 2 / 3;
    object-fit: cover;
}
#page-info .poster > a > img {
    width: 100% !important;
    height: auto;
    max-height: none;
    aspect-ratio: 2 / 3;
    object-fit: cover;
}

/* Player fixes retain the original controls and a 16:9 video surface. */
.box-player { height: auto !important; }
#player.embed-responsive { position: relative; width: 100%; height: auto !important; padding: 0; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
#player iframe, #player video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
#player .player-error { position: absolute; bottom: 45px; width: 100%; padding: 8px; background: #222; color: #fff; }
.div-control { overflow: auto; padding: 5px 0; }
.video-btn, .streaming-server { font-size: 14px; min-height: 34px; }
.tip-change-server { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 100%; }
body.lights-off::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 98; }
body.lights-off #box-player, body.lights-off .div-control, body.lights-off .tip-change-server { position: relative; z-index: 99; }
/* The original landscape carousel height must grow with portrait images. */
#film_hot, #film_related { height: auto !important; }

/* HentaiSub identity: indigo surfaces and violet accents on the existing layout. */
:root {
    --hs-accent: #aa98ff;
    --hs-accent-hover: #d0c4ff;
    --hs-surface: #111a31;
    --hs-outline: #34416b;
}
body, html { background-color: #080d1c; }
#header { background: #121a34; }
.main-menu, .main-menu .menu-item .sub-menu { background: #1c2549; }
.main-menu .menu-item.active > a,
.main-menu .menu-item > a:hover {
    background: #393263;
    color: #e5deff;
}
.title-box .tophot,
.title-box .tab.active,
.title-box .tab:hover,
.right-content .block .caption,
.server-episode-block,
h2.heading,
h3.heading a {
    color: var(--hs-accent) !important;
    border-color: #8272d2;
}
.title-box .tab.active, .title-box .tab:hover { border-bottom-color: #a18cf2; }
.list-films.film-new .item,
.list-films #film_hot .item,
.list-films #film_related .item {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 0 1px var(--hs-outline);
    background: var(--hs-surface);
}
.list-films.film-new .item .name,
.list-films.film-hot .item .text,
.list-films.film-related .item .text {
    background: #111a31 !important;
    color: #f2efff;
    opacity: .97;
}
.list-films .item .name-title { font-size: 14px; line-height: 1.4; }
.list-films .item .name a,
.list-films .item .text a { color: #f2efff; }
.list-films .item .name a:hover,
.list-films .item .text a:hover,
.list-film .film-item-ver .name a:hover,
.most-view .list-film .item a:hover { color: var(--hs-accent-hover); }
.list-films .item .icon-play { background: #7865cdcc !important; }
.list-films .label-quality,
#film_hot .item .label,
#film_related .item .label,
.film-new .item .label { background: #6252ae; border-bottom-color: #4c4089; }
.list-films .label-quality:after { border-left-color: #6252ae; }
span.label1 { background: #7160b8; border-bottom-color: #55488e; }
.list-film li:nth-child(even),
#page-info .blockbody,
#player-video .bottom-content,
.breadcrumbs { background: #10172b; }
.list-film .film-item-ver img.avatar { border-color: #536394; border-radius: 5px; }
.most-view .list-film .item .number-rank { background: #8070ca; color: #fff; }
#page-info .blockbody .text h1 a,
#page-info .blockbody .title,
#player-video .details .name h1 a,
#player-video .details .name span { color: var(--hs-accent-hover) !important; }
#page-info .latest-episode > a:hover,
.list-episode > a:hover,
.list-episode > a.current,
ul.server-backup li span.active,
ul.server-backup li span:hover,
.streaming-server.btn-success,
.poster .btn-danger,
.form-filter .btn-success {
    background: #7561c9;
    border-color: #8975dd;
    color: #fff;
}
.list-episode > a.current { box-shadow: inset 0 0 0 1px #d3c9ff; }
.poster .btn-danger:hover, .form-filter .btn-success:hover { background: #8b75df; }
.film-note, .cc-warning { border-color: #5a5189 !important; background: #171d35; }
.cc-warning a, .notification a { color: var(--hs-accent-hover); }
.home-genre-more-link { background: #202947; border-color: #4b5781; color: #e7e1ff; }
.home-genre-more-link:hover,
.home-genre-more-link:focus { color: #f5f1ff; background: #393263; border-color: #a18cf2; }
.pagination .current, .pagination a:hover { background: #6252ae; border-color: #a18cf2; color: #fff; }
#footer { background: #121a31; color: #a8aec7; }
#footer .info { background: #1a2341; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid var(--hs-accent);
    outline-offset: 3px;
}
