@media(max-width:767px){
    .bottom-nav:not(.reader-footer)::before,
    .bottom-nav:not(.reader-footer)::after{content:"";position:absolute;top:-1px;bottom:0;width:max(0px,calc((100vw - 100%)/2));background:inherit;border-top:inherit;pointer-events:none}
    .bottom-nav:not(.reader-footer)::before{right:100%}
    .bottom-nav:not(.reader-footer)::after{left:100%}
}
/* Text columns must shrink before they can truncate inside flex/grid layouts. */
header :is(.brand-identity,.brand-block){flex:1 1 0;min-width:0}
header .brand-identity>.brand{flex:0 1 auto;min-width:min(3.2em,100%)}
header.home-header .brand-row,header .brand-row{flex:0 1 auto;min-width:0;overflow:hidden}
header .brand-row .brand{flex:0 1 auto}
header .age-label{flex-shrink:0}
header :is(.brand,.brand-subtitle,.site-type){display:block;min-width:0;max-width:100%;overflow:hidden!important;text-overflow:ellipsis;white-space:nowrap}
header :is(.header-actions,.actions){flex-shrink:0}
:is(.section-heading,.section-head)>h2{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
:is(.site-footer,.page-footer) p{overflow-wrap:anywhere}

/* Long labels must fit their card even when the page clips horizontal overflow. */
.tags,.editorial-info{min-width:0;max-width:100%}
.tags>:is(a,span),.tag-link,.home-tag-grid>a{box-sizing:border-box;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tag-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tag-count{flex-shrink:0}
/* All nine novel themes: labels size to their text and wrap without truncation. */
body[data-channel=novel] :is(.home-tag-grid,.tag-directory,.genre-tiles){display:flex;flex-wrap:wrap;align-items:flex-start}
body[data-channel=novel] :is(.home-tag-grid,.tag-directory,.genre-tiles)>a{flex:0 1 auto;width:auto;max-width:none;height:auto;max-height:none}
body[data-channel=novel] :is(.tags,.novel-detail-tags,.novel-filter-group,.filters,.filter-row>div){flex-wrap:wrap}
body[data-channel=novel] :is(.tags>a,.tags>span,.tag,.tag-link,.tag-name,.home-tag-grid>a,.genre-tiles>a,.genre-tiles>a>span,.novel-filter-group>a,.filters>.chip,.filter-row .chip,.novel-meta>a){width:auto;max-width:none;height:auto;max-height:none;overflow:visible;text-overflow:clip;white-space:normal;overflow-wrap:anywhere;-webkit-line-clamp:unset;line-clamp:unset}
body[data-channel=novel] :is(.section-heading,.section-head)>h2{overflow:visible;text-overflow:clip;white-space:normal;overflow-wrap:anywhere}
body[data-channel=novel] :is(.novel-card>p,.novel-meta,.novel-byline){max-width:none;max-height:none;overflow:visible;text-overflow:clip;white-space:normal;overflow-wrap:anywhere;-webkit-line-clamp:unset;line-clamp:unset}
body[data-channel=novel] .rank .tags .tag:last-child{display:inline-flex}
.home-update-list article>div{min-width:0;max-width:100%}
.home-update-list article>div>span{display:block;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.home-ranking li,.home-ranking li>a,.home-ranking li>a>div{min-width:0;max-width:100%}
.home-ranking li p{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.catalog-introduction>div{flex:1 1 0;min-width:0;max-width:100%}
.catalog-introduction h2{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden;overflow-wrap:anywhere}
.catalog-introduction p{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;line-clamp:3;overflow:hidden;overflow-wrap:anywhere}
.catalog-introduction :is(.intro-monogram,.age-stamp){flex-shrink:0}

/* Keep navigation cells stable when a translated label is unusually long. */
:is(.catalog-nav,.quick-nav,.home-shortcuts,.desktop-nav){min-width:0;max-width:100%}
.bottom-nav{min-width:0}
:is(.catalog-nav,.quick-nav,.home-shortcuts,.bottom-nav,.desktop-nav) a{min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
:is(.catalog-nav,.quick-nav,.home-shortcuts,.bottom-nav) a>span:not(:has(svg)){display:block;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* Novel recommendations have their own artwork geometry; constrain their copy. */
.novel-author-profile{margin:0 0 20px;padding:16px 0;border-bottom:1px solid var(--line,#ddd);overflow-wrap:anywhere}
.novel-author-profile h1{font-size:22px;line-height:1.5;margin:0 0 8px}
.novel-author-profile p{margin:6px 0;line-height:1.7;white-space:pre-line}
.novel-author-link:hover{text-decoration:underline}
body[data-channel=novel] :is(.novel-focus-copy,.focus-copy,.hero-copy,.focus-caption){min-width:0;max-width:100%;max-height:calc(100% - 24px);overflow:hidden;overflow-wrap:anywhere}
body[data-channel=novel] :is(.novel-focus-copy,.focus-copy,.hero-copy,.focus-caption)>:is(p,small,.focus-kicker,.focus-label,.focus-eyebrow,.eyebrow){display:block;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media(max-width:600px){
    .home-header .brand-block{display:block}
    .home-header .brand-row{max-width:100%}
    .home-header .site-type{border:0;padding:0;margin-top:3px}
}
/* One desktop shell for comic, novel and traditional video pages. */
@media(min-width:900px){
    body:not(.video-immersive){--page-shell-width:1280px;--shell:1280px}
    body:not(.video-immersive) :is(.app-shell,.app){width:100%;max-width:1280px!important;--page-shell-width:1280px!important;--shell:1280px!important}
    body:not(.video-immersive) :is(.bottom-nav,.reader-bottom,.reader-footer,.reading-progress){width:100%;max-width:1280px!important;--page-shell-width:1280px!important;--shell:1280px!important}
    /* Collapse unused tracks; content counts remain controlled by the admin. */
    body:not(.video-immersive) :is(.book-grid,.catalog-grid,.novel-card-grid,.fresh-grid,.app .grid){grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr))}
    body.video-site:not(.video-immersive) .video-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,250px),1fr))}
}

/* Home/detail shelves use divisors of 12/24 rather than auto-fit's variable 5-column track. */
@media(min-width:900px){
    body:not(.video-immersive) .full-row-section :is(.book-grid:not(.ongoing-grid):not(.new-grid),.catalog-grid,.novel-card-grid,.fresh-grid,.grid){grid-template-columns:repeat(6,minmax(0,1fr))}
    body.video-site:not(.video-immersive) :is(.video-home-section,.video-play-related) .video-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
}
/* A sparse live novel ranking may have an odd number of leaders. */
body[data-channel=novel] .full-row-section .novel-list>:last-child:nth-child(odd){grid-column:1 / -1}
