/* papapahub — minimal framework, replaces Bootstrap.
   Implements exactly the class vocabulary the (now single, responsive)
   template set uses -- grid, buttons, dropdown, modal, carousel, badge,
   pagination, card, form controls, spacing/text/display utilities --
   nothing more. Loaded before site.css, which keeps its --pp-* tokens
   and its own overrides on top of this. Paired with ui.js for the
   handful of JS-driven components (dropdown, modal, carousel) that used
   to come from bootstrap.bundle.min.js, keyed off the same data-bs-*
   attributes so template markup didn't have to change.
*/

*, *::before, *::after { box-sizing: border-box; }

/* ---------- Grid (12-column, Bootstrap-compatible breakpoints) ---------- */
.container, .container-fluid {
	width: 100%;
	padding-inline: .75rem;
	margin-inline: auto;
}
@media (min-width: 576px) { .container { max-width: 540px; } }
@media (min-width: 768px) { .container { max-width: 720px; } }
@media (min-width: 992px) { .container { max-width: 960px; } }
@media (min-width: 1200px) { .container { max-width: 1140px; } }

.row {
	display: flex;
	flex-wrap: wrap;
	margin-inline: -.375rem;
}
.row > * { padding-inline: .375rem; }

.g-3 { row-gap: 1rem; }
.g-3 > * { padding-inline: .5rem; }

[class^="col-"], [class*=" col-"] { width: 100%; }

/* col-N / offset-N, generated for exactly the values the templates use. */
.col-3 { flex: 0 0 auto; width: 25%; }
.col-6 { flex: 0 0 auto; width: 50%; }
.col-7 { flex: 0 0 auto; width: 58.333333%; }
.col-10 { flex: 0 0 auto; width: 83.333333%; }
.col-12 { flex: 0 0 auto; width: 100%; }
.offset-1 { margin-left: 8.333333%; }
.offset-3 { margin-left: 25%; }

@media (min-width: 576px) {
	.col-sm-4 { flex: 0 0 auto; width: 33.333333%; }
	.col-sm-8 { flex: 0 0 auto; width: 66.666667%; }
}
@media (min-width: 768px) {
	.col-md-6 { flex: 0 0 auto; width: 50%; }
}
@media (min-width: 992px) {
	.col-lg-8 { flex: 0 0 auto; width: 66.666667%; }
	.offset-lg-2 { margin-left: 16.666667%; }
}

/* Detail-page image+content split: full-width stack below 768px instead
   of the fixed col-3/col-7 desktop split, since this now serves every
   screen size instead of only ever rendering for a PC-class viewport. */
@media (max-width: 767.98px) {
	.col-3, .col-6, .col-7, .col-10, .col-sm-4, .col-sm-8, .col-md-6, .col-lg-8 { width: 100%; }
	.offset-1, .offset-3, .offset-lg-2 { margin-left: 0; }
}

/* ---------- Display / flex / spacing / sizing utilities ---------- */
.d-block { display: block; }
.d-grid { display: grid; }
.d-flex { display: flex; }
.d-none { display: none; }
.flex-wrap { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }
.align-items-center { align-items: center; }
.align-middle { vertical-align: middle; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: 1rem; }
.w-100 { width: 100%; }
.min-vh-100 { min-height: 100vh; }
.lh-1 { line-height: 1; }

.m-0 { margin: 0; }
.m-1 { margin: .25rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }
.me-2 { margin-right: .5rem; }
.me-3 { margin-right: 1rem; }
.me-auto { margin-right: auto; }
.ms-1 { margin-left: .25rem; }
.ms-2 { margin-left: .5rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.p-1 { padding: .25rem; }
.px-1 { padding-inline: .25rem; }
@media (min-width: 576px) { .pt-sm-2 { padding-top: .5rem; } .me-md-3 { margin-right: 1rem; } }

/* ---------- Text ---------- */
.small { font-size: .875em; }
.fw-normal { font-weight: 400; }
.fw-semibold { font-weight: 600; }
.text-center { text-align: center; }
.text-nowrap { white-space: nowrap; }
.text-uppercase { text-transform: uppercase; }
.text-break { word-break: break-word; overflow-wrap: anywhere; }
.text-decoration-none { text-decoration: none; }
.text-truncate {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.text-muted { color: var(--pp-muted); }
.text-light, .text-white { color: var(--pp-text); }
.text-dark, .text-secondary { color: var(--pp-muted); }
.text-danger { color: var(--pp-brand); }

/* ---------- Borders / misc ---------- */
.position-relative { position: relative; }
.position-absolute { position: absolute; }
.border-top { border-top: 1px solid var(--pp-border); }
.border-secondary { border: 1px solid var(--pp-border) !important; }
.rounded { border-radius: var(--pp-radius-sm); }
.img-fluid { max-width: 100%; height: auto; }
.disabled, [disabled] { opacity: .55; pointer-events: none; }
.fade { transition: opacity .15s linear; }
.bg-dark { background: var(--pp-surface); }
.bg-primary { background: var(--pp-brand); }
.bg-secondary { background: var(--pp-surface-2); }
.bg-warning { background: var(--pp-gold); color: #2a1c04; }
.bg-opacity-75 { opacity: .75; }
.visually-hidden {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Buttons ---------- */
.btn {
	--bs-btn-padding-y: .5rem;
	--bs-btn-padding-x: 1.1rem;
	--bs-btn-font-size: .9rem;
	--bs-btn-bg: var(--pp-surface-2);
	--bs-btn-border-color: var(--pp-border);
	--bs-btn-color: var(--pp-text);
	--bs-btn-hover-bg: var(--pp-border);
	--bs-btn-hover-border-color: var(--pp-border);
	--bs-btn-hover-color: var(--pp-text);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .4em;
	padding: var(--bs-btn-padding-y) var(--bs-btn-padding-x);
	font-size: var(--bs-btn-font-size);
	font-weight: 500;
	line-height: 1.2;
	color: var(--bs-btn-color);
	background: var(--bs-btn-bg);
	border: 1px solid var(--bs-btn-border-color);
	border-radius: 999px;
	cursor: pointer;
	text-decoration: none;
	transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { background: var(--bs-btn-hover-bg); border-color: var(--bs-btn-hover-border-color); color: var(--bs-btn-hover-color); }
.btn-sm { --bs-btn-padding-y: .3rem; --bs-btn-padding-x: .75rem; --bs-btn-font-size: .8rem; }
.btn-lg { --bs-btn-padding-y: .7rem; --bs-btn-padding-x: 1.4rem; --bs-btn-font-size: 1rem; }

.btn-danger, .btn-primary {
	--bs-btn-bg: var(--pp-brand);
	--bs-btn-border-color: var(--pp-brand);
	--bs-btn-color: #fff;
	--bs-btn-hover-bg: var(--pp-brand-600);
	--bs-btn-hover-border-color: var(--pp-brand-600);
	--bs-btn-hover-color: #fff;
	font-weight: 600;
}
.btn-outline-danger {
	--bs-btn-bg: transparent;
	--bs-btn-border-color: color-mix(in srgb, var(--pp-brand) 55%, transparent);
	--bs-btn-color: var(--pp-brand);
	--bs-btn-hover-bg: var(--pp-brand);
	--bs-btn-hover-border-color: var(--pp-brand);
	--bs-btn-hover-color: #fff;
}
.btn-outline-light {
	--bs-btn-bg: transparent;
	--bs-btn-border-color: var(--pp-border);
	--bs-btn-color: var(--pp-text);
	--bs-btn-hover-bg: var(--pp-surface-2);
	--bs-btn-hover-border-color: var(--pp-border);
	--bs-btn-hover-color: var(--pp-text);
}
.btn-outline-secondary {
	--bs-btn-bg: transparent;
	--bs-btn-border-color: var(--pp-border);
	--bs-btn-color: var(--pp-muted);
	--bs-btn-hover-bg: var(--pp-surface-2);
	--bs-btn-hover-border-color: var(--pp-border);
	--bs-btn-hover-color: var(--pp-text);
}
.btn-info {
	--bs-btn-bg: var(--pp-surface-2);
	--bs-btn-border-color: var(--pp-border);
	--bs-btn-color: var(--pp-text);
	--bs-btn-hover-bg: var(--pp-border);
	--bs-btn-hover-border-color: var(--pp-border);
	--bs-btn-hover-color: var(--pp-text);
}
.btn-link {
	--bs-btn-bg: transparent;
	--bs-btn-border-color: transparent;
	--bs-btn-color: var(--pp-text);
	--bs-btn-hover-bg: transparent;
	--bs-btn-hover-border-color: transparent;
	--bs-btn-hover-color: var(--pp-brand);
	border-radius: 50%;
	padding: .4rem;
}
.btn-close {
	width: 1.6rem;
	height: 1.6rem;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3E%3Cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3E%3C/svg%3E") center / 1rem no-repeat;
	cursor: pointer;
}
.btn-close-white { filter: invert(1) grayscale(100%) brightness(200%); }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu {
	display: none;
	position: absolute;
	z-index: 1050;
	top: 100%;
	left: 0;
	margin-top: .4rem;
	min-width: 10rem;
	padding: .4rem;
	list-style: none;
	background: var(--pp-surface);
	border: 1px solid var(--pp-border);
	border-radius: var(--pp-radius-sm);
	box-shadow: var(--pp-shadow);
}
.dropdown-menu.show { display: block; }
.dropdown-menu-end { left: auto; right: 0; }
.dropdown-item {
	display: block;
	width: 100%;
	padding: .5rem .7rem;
	border-radius: 8px;
	color: var(--pp-text);
	text-decoration: none;
	font-size: .88rem;
	background: none;
	border: none;
	text-align: left;
	cursor: pointer;
}
.dropdown-item:hover { background: var(--pp-surface-2); }
.dropdown-item.active { background: var(--pp-surface-2); color: #fff; }
.dropdown-item-text { padding: .5rem .7rem; color: var(--pp-muted); }
.dropdown-divider { margin: .4rem 0; border: none; border-top: 1px solid var(--pp-border); }
.dropdown-toggle::after {
	content: "";
	display: inline-block;
	width: .35em; height: .35em;
	margin-left: .3em;
	border-right: .12em solid currentColor;
	border-bottom: .12em solid currentColor;
	transform: rotate(45deg) translateY(-.15em);
}

/* ---------- Modal ---------- */
.modal {
	position: fixed;
	inset: 0;
	z-index: 1300;
	display: none;
	overflow-y: auto;
	padding: 1rem;
}
.modal.show { display: block; }
.modal-dialog {
	max-width: 480px;
	margin: 2rem auto;
}
.modal-dialog-centered {
	display: flex;
	align-items: center;
	min-height: calc(100% - 4rem);
	margin: 2rem auto;
}
.modal-content {
	width: 100%;
	background: var(--pp-surface);
	border: 1px solid var(--pp-border);
	border-radius: var(--pp-radius);
	box-shadow: var(--pp-shadow);
}
.modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1.1rem 1.25rem;
	border-bottom: 1px solid var(--pp-border);
}
.modal-title { margin: 0; font-size: 1.05rem; font-weight: 700; }
.modal-body { padding: 1.25rem; }
.modal-backdrop {
	position: fixed;
	inset: 0;
	z-index: 1290;
	background: rgba(0, 0, 0, .6);
	opacity: 0;
	transition: opacity .2s ease;
}
.modal-backdrop.show { opacity: 1; }

/* ---------- Carousel ---------- */
.carousel { position: relative; }
.carousel-inner { position: relative; overflow: hidden; width: 100%; }
.carousel-item { display: none; }
.carousel-item.active { display: block; }
/* Buttons sit beside the fixed-size image box (.carousel-row), not floating
   on top of it -- a translucent circle over a photo is easy to miss and
   easy to mistake for part of the content; a plain chip in the surrounding
   gutter reads as chrome, not something to tap through. */
.carousel-row {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .5rem;
	width: 100%;
}
.carousel-control-prev, .carousel-control-next {
	position: static;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	border: none;
	border-radius: 50%;
	background: var(--pp-surface-2);
	cursor: pointer;
	opacity: .9;
}
.carousel-control-prev:hover, .carousel-control-next:hover { opacity: 1; }
.carousel-control-prev-icon, .carousel-control-next-icon {
	display: inline-block;
	width: 1.25rem;
	height: 1.25rem;
	background-position: center;
	background-repeat: no-repeat;
	background-size: 100%;
}
.carousel-control-prev-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3E%3Cpath d='M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z'/%3E%3C/svg%3E"); }
.carousel-control-next-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3E%3Cpath d='M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E"); }
.carousel-indicators {
	position: absolute;
	z-index: 2;
	bottom: .75rem;
	left: 0;
	right: 0;
	display: flex;
	justify-content: center;
	gap: .35rem;
	padding: 0;
	margin: 0;
}
.carousel-indicators button {
	width: .5rem;
	height: .5rem;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, .5);
	cursor: pointer;
}
.carousel-indicators button.active { background: #fff; }

/* ---------- Forms ---------- */
.form-control, .form-select {
	display: block;
	width: 100%;
	padding: .5rem .8rem;
	font-size: .9rem;
	color: var(--pp-text);
	background: var(--pp-surface-2);
	border: 1px solid var(--pp-border);
	border-radius: var(--pp-radius-sm);
}
.form-control:focus, .form-select:focus {
	outline: none;
	border-color: var(--pp-brand);
	box-shadow: 0 0 0 .2rem var(--pp-brand-soft);
}
.form-control-sm { padding: .3rem .6rem; font-size: .82rem; }
.form-label { display: block; margin-bottom: .35rem; font-size: .85rem; color: var(--pp-muted); }
.form-floating { position: relative; }
.form-floating > .form-control {
	height: calc(3.5rem + 2px);
	padding: 1rem .8rem;
}
.form-floating > .form-control::placeholder { color: transparent; }
.form-floating > label {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	padding: 1rem .8rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--pp-muted);
	pointer-events: none;
	border: 1px solid transparent;
	transform-origin: 0 0;
	transition: opacity .1s ease, transform .1s ease;
}
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
	opacity: .75;
	transform: scale(.82) translateY(-.65rem) translateX(.15rem);
}
.input-group { display: flex; align-items: stretch; }
.input-group > .form-control { border-radius: 999px 0 0 999px; }
.input-group > .btn { border-radius: 0 999px 999px 0; }

/* ---------- Badge / pagination / card ---------- */
.badge { display: inline-block; padding: .3em .55em; font-size: .72em; font-weight: 600; border-radius: 999px; color: #fff; }

.pagination { display: flex; list-style: none; padding: 0; margin: 0; gap: .3rem; flex-wrap: wrap; }
.page-item.disabled .page-link { opacity: .4; pointer-events: none; }
.page-item.active .page-link { background: var(--pp-brand-soft); color: #fff; border-color: transparent; }
.page-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.2rem;
	height: 2.2rem;
	padding: 0 .6rem;
	color: var(--pp-muted);
	background: var(--pp-surface);
	border: 1px solid var(--pp-border);
	border-radius: 999px;
	text-decoration: none;
	font-size: .85rem;
}
.page-link:hover { color: var(--pp-text); background: var(--pp-surface-2); }

.card {
	background: var(--pp-surface);
	border: 1px solid var(--pp-border);
	border-radius: var(--pp-radius);
}
.card-body { padding: 1.25rem; }

/* papapahub — YouTube-dark identity
   Custom layer on top of framework.css (replaces Bootstrap). Neutral
   black/gray surfaces (no rose tint on the background itself anymore),
   the rose accent reserved for brand + interactive elements, gold for
   quality badges. */

:root {
    --pp-bg: #0f0f0f;          /* neutral near-black */
    --pp-surface-0: #121212;   /* barely-there fill, e.g. the search bar -- pixel-matched to YouTube's own */
    --pp-surface: #181818;     /* nav, cards */
    --pp-surface-2: #272727;   /* raised / hover surface, also the selected-pill fill (measured) */
    --pp-border: #3d3d3d;
    --pp-text: #f1f1f1;
    --pp-muted: #aaaaaa;
    --pp-brand: #ff2d6b;       /* hot rose — brand + interactive, unchanged */
    --pp-brand-600: #e01f58;   /* pressed / darker */
    --pp-brand-soft: rgba(255, 45, 107, .14);
    --pp-gold: #ffc24b;        /* quality badges only */

    --pp-radius: 14px;
    --pp-radius-sm: 9px;
    --pp-shadow: 0 6px 22px rgba(0, 0, 0, .45);
    --pp-shadow-hover: 0 12px 30px rgba(0, 0, 0, .55), 0 0 0 1px var(--pp-brand);
}

/* ---------- Typography ---------- */
body {
    background: var(--pp-bg);
    color: var(--pp-text);
    font-family: "Plus Jakarta Sans", system-ui, "PingFang SC",
        "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
    letter-spacing: .1px;
}

h1, h2, h3, h4, h5, h6, .brand {
    font-family: "Sora", system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
    letter-spacing: -.01em;
}

h1 {
    font-weight: 800;
    font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2.1rem);
    line-height: 1.15;
}

/* ---------- Brand wordmark ---------- */
.brand {
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -.02em;
    color: var(--pp-text);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .12em;
    white-space: nowrap;
}
.brand:hover { color: var(--pp-text); }
.brand .brand-hub { color: var(--pp-brand); }

/* ---------- App shell: top bar + left sidebar (YouTube/dogbar layout) ---------- */
:root {
    --topbar-height: 64px;
    --sidebar-width: 240px;
}

.app-shell { min-height: 100vh; }

.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-height);
    z-index: 1031;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    padding: .5rem 1rem;
    /* Same fill as .sidebar/.content (--pp-bg), not the lighter --pp-surface
       cards use -- a visibly different bar color read as a panel floating
       on top of the page instead of being part of it. YouTube's own chrome
       is one flat background with hairline borders, not tonal separation. */
    background: var(--pp-bg);
    border-bottom: 1px solid var(--pp-border);
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--pp-text);
    cursor: pointer;
}
.icon-btn:hover { background: var(--pp-surface-2); }
/* The inline SVG carries no width/height of its own; without an explicit size
   iOS Safari collapses it to 0 inside this flex button and the hamburger
   vanishes (the button itself stays, leaving a blank gap left of the brand). */
.icon-btn .icon { width: 24px; height: 24px; flex-shrink: 0; }

.brand { flex-shrink: 0; margin-right: .25rem; }

.searchbar {
    flex: 1;
    max-width: 640px;
    margin-inline: auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .5rem;
    height: 40px;
    padding: 0 1rem;
    border: 1px solid var(--pp-border);
    border-radius: 999px;
    background: var(--pp-surface-0);
}
.searchbar:focus-within { border-color: var(--pp-brand); }
.searchbar .icon { color: var(--pp-muted); width: 18px; height: 18px; flex-shrink: 0; }
.searchbar input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--pp-text);
    font-size: .9rem;
    font-family: inherit;
}

/* Narrow screens: menu/brand/account/language don't leave enough room for a
   usable search box on the same row (account+language dropdowns are new
   next to what dogbar's simpler topbar had) -- drop search to its own full
   row underneath instead of letting it get squeezed to nothing. */
@media (max-width: 575px) {
    /* Two rows: the controls, then a full-width search underneath. Pin the bar
       to a fixed height and pack the rows at the top (align-content) so the
       one number below clears it exactly -- letting it wrap to `auto` made the
       height depend on how the flex wrap landed, and .content/.sidebar were
       guessing at it with a magic +48px that left the drawer's first row
       tucked under the bar on anything that rendered a pixel taller. */
    .topbar { height: 112px; align-content: flex-start; }
    .searchbar { order: 10; flex-basis: 100%; max-width: none; margin: 0; }
    /* Row 1 has no flex-grow child once search wraps away, so menu/brand/lang
       clump at the left. Push the language control out to the right edge. */
    .lang-menu { margin-left: auto; }
    /* .content/.sidebar are re-declared with their base values further down,
       so match that extra ancestor to keep this override winning. */
    .app-shell .content { margin-top: 112px; min-height: calc(100vh - 112px); }
    .app-shell .sidebar { top: 112px; }
}

/* left sidebar — one vertical list, no dropdown needed: unlike the old
   horizontally-scrolling catbar, a sidebar has the vertical room to just
   list every section (jav/uncensored/ranking included) without collapsing
   any of them, so their existing indexable URLs are untouched. */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    overflow-y: auto;
    background: var(--pp-bg);
    padding: .75rem .5rem;
    z-index: 1020;
    transition: transform .2s ease;
}

/* Text/icon color is white at every state -- pixel-sampled directly off a
   real YouTube dark-mode screenshot: unselected sidebar items are just as
   white as selected ones (~#fbfbfb either way), never dimmed to gray.
   Gray is reserved for secondary metadata (view counts, channel names),
   not applied to nav items themselves. The only thing that changes
   between rest/hover/active is the pill's own background fill. */
.nav-item {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 40px;
    padding: 0 1rem;
    border-radius: 10px;
    color: var(--pp-text);
    font-weight: 500;
    font-size: .875rem;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s ease;
}
.nav-item .icon { width: 24px; height: 24px; flex-shrink: 0; color: var(--pp-text); }
/* Region tabs (J-Korean/Western) use a flag emoji instead of a line icon --
   there's no generic glyph for "region" in the Material Symbols set, and a
   real flag reads instantly where an arbitrary shape wouldn't. Sized/centered
   to sit flush with the 24px line icons above and below it in the list.
   Desaturated so it reads as "flag" / "globe" in outline without breaking
   the rest of the nav's all-white-line-icon look with a patch of full color. */
.nav-item .icon-emoji {
    width: 24px;
    flex-shrink: 0;
    text-align: center;
    font-size: 20px;
    line-height: 1;
    filter: grayscale(1) contrast(1.15) brightness(1.35);
}
.nav-item:hover { background: var(--pp-surface-2); }
/* Plain neutral fill (measured #272727), not a tinted brand wash -- a
   translucent rose overlay on near-black read as a muddy dark maroon
   instead of a clean "this one's selected" cue. */
.nav-item.active {
    background: var(--pp-surface-2);
    font-weight: 600;
}

/* Sections: browse / catalogue / people / archive, plus the account block.
   A single hairline between groups, matching YouTube's guide -- enough to
   read as structure without drawing a box around anything. */
.nav-group + .nav-group {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--pp-border);
}

/* Signed-in address above the Sign out row: secondary metadata, so grey
   (the one place grey is allowed in this nav -- see the note above). */
.nav-user {
    display: block;
    padding: 4px 1rem 8px;
    font-size: .75rem;
    color: var(--pp-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Account lives in the top-right menu (.account-menu) on desktop, YouTube-
   style. This drawer copy only appears once that menu is hidden on phones,
   where the top bar has no room for it -- like YouTube mobile's "You" tab. */
.nav-group--account { display: none; }

.content {
    margin-top: var(--topbar-height);
    margin-left: var(--sidebar-width);
    padding: 1.25rem 1.5rem 3rem;
    /* Sticky footer: .content's only two children are .content-body and
       .site-footer, whose margin-top: auto (below) pushes it to the bottom
       on a short page. */
    min-height: calc(100vh - var(--topbar-height));
    display: flex;
    flex-direction: column;
}
/* {% block content %}'s wrapper: guarantees the gap above the footer on a
   page long enough to fill the viewport on its own, when the footer's own
   margin-top: auto has no leftover space left to push through (it was 0
   without this -- a paginator right above the footer sat flush against it). */
.content-body { margin-bottom: 48px; }

body.sidebar-collapsed .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
body.sidebar-collapsed .content { margin-left: 0; }

.site-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--pp-border);
    color: var(--pp-muted);
    font-size: .75rem;
    text-align: center;
}

@media (max-width: 900px) {
    /* Drawer, not a rail: a touch surface, so wider with 48px rows (Material's
       min touch target -- the 40px desktop row is a mouse target). The icon
       and 14px label carry over fine; only the box around them grows. */
    .sidebar {
        width: 280px;
        padding: .5rem;
        transform: translateX(-100%);
        box-shadow: var(--pp-shadow);
    }
    .nav-item { height: 48px; gap: 16px; }
    .content { margin-left: 0; }
    body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .account-menu { display: none; }
    .nav-group--account { display: block; }
}
@media (max-width: 575px) {
    .brand { font-size: 1.1rem; }
}

/* ---------- Synchronized live channel ---------- */
.live-container {
    max-width: 1440px;
    margin-inline: auto;
    padding-top: 1rem;
    padding-bottom: 2rem;
}
.live-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(250px, 330px);
    gap: 1rem;
    align-items: start;
}
.live-stage,
.live-now-card,
.live-program-card {
    background: var(--pp-surface);
    border: 1px solid var(--pp-border);
    border-radius: var(--pp-radius);
    box-shadow: var(--pp-shadow);
}
.live-stage { overflow: hidden; }
.live-video-wrap {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
}
.live-player {
    display: block;
    width: 100%;
    height: 100%;
    background: #000;
}
.live-player.live-pending { visibility: hidden; }
.live-start {
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    min-width: 9rem;
}
.live-start[hidden] { display: none; }
.live-toolbar {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    padding: .7rem .9rem;
    font-size: .85rem;
}
.live-dot {
    display: inline-block;
    width: .55rem;
    height: .55rem;
    margin-right: .35rem;
    border-radius: 50%;
    background: var(--pp-brand);
    box-shadow: 0 0 0 .2rem var(--pp-brand-soft);
    vertical-align: .05em;
}
.live-sidebar { display: grid; gap: 1rem; }
.live-now-card,
.live-program-card { padding: 1rem; }
.live-now-title {
    margin: .35rem 0 .45rem;
    font-size: clamp(1.1rem, 1rem + .65vw, 1.55rem);
    overflow-wrap: anywhere;
}
.live-now-meta { color: var(--pp-muted); font-size: .85rem; margin-bottom: .85rem; }
.live-program-list { list-style: none; padding: 0; margin: 0; }
.live-program-list li {
    display: grid;
    gap: .18rem;
    padding: .65rem 0;
    border-bottom: 1px solid var(--pp-border);
}
.live-program-list li:last-child { border-bottom: 0; }
.live-program-title { overflow-wrap: anywhere; }
.live-program-meta { color: var(--pp-muted); }
.live-description { max-width: 70rem; margin: 1rem .25rem 0; }
@media (max-width: 767.98px) {
    .live-container { padding-top: .5rem; }
    .live-layout { display: block; }
    .live-sidebar { margin-top: .75rem; }
    .live-toolbar { font-size: .78rem; }
}

/* ---------- Buttons: rose is the one loud color ---------- */
.btn-danger {
    --bs-btn-bg: var(--pp-brand);
    --bs-btn-border-color: var(--pp-brand);
    --bs-btn-hover-bg: var(--pp-brand-600);
    --bs-btn-hover-border-color: var(--pp-brand-600);
    --bs-btn-active-bg: var(--pp-brand-600);
    font-weight: 600;
}
.btn-outline-danger {
    --bs-btn-color: var(--pp-brand);
    --bs-btn-border-color: color-mix(in srgb, var(--pp-brand) 55%, transparent);
    --bs-btn-hover-bg: var(--pp-brand);
    --bs-btn-hover-border-color: var(--pp-brand);
    --bs-btn-hover-color: #fff;
    font-weight: 500;
}
/* language / utility button — keep it quiet, not bright cyan */
.btn-info {
    --bs-btn-bg: var(--pp-surface-2);
    --bs-btn-border-color: var(--pp-border);
    --bs-btn-color: var(--pp-text);
    --bs-btn-hover-bg: var(--pp-border);
    --bs-btn-hover-border-color: var(--pp-border);
    --bs-btn-hover-color: var(--pp-text);
}

.form-control {
    background: var(--pp-surface-2);
    border-color: var(--pp-border);
    color: var(--pp-text);
}
.form-control:focus {
    background: var(--pp-surface-2);
    color: var(--pp-text);
    border-color: var(--pp-brand);
    box-shadow: 0 0 0 .2rem var(--pp-brand-soft);
}

/* ---------- Video grid (replaces fixed col-3) ---------- */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: clamp(.6rem, .4rem + .6vw, 1.1rem);
    margin: .75rem 0 1.25rem;
    width: 100%;
}
/* Desktop: denser scan-first grid (mobile keeps ~2 cols via the base rule).
   Tune the min width to change density: ~420px≈4/row, ~320px≈5/row,
   ~288px≈6/row on a wide screen, ~260px≈6-7/row. */
@media (min-width: 992px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
    }
}
.video-grid > * {           /* neutralize Bootstrap col-* sizing */
    width: auto;
    max-width: none;
    flex: none;
    margin: 0;
    padding: 0;
    min-width: 0;            /* grid items default to min-width:auto, which lets
                                 unbreakable text (e.g. long underscore-joined
                                 titles) force the column wider than its track */
}

.video-grid a { display: block; color: inherit; }

/* thumbnail frame: fixed 16:9 so the grid never reflows (no CLS) */
.video-grid .position-relative {
    aspect-ratio: 16 / 9;
    border-radius: var(--pp-radius);
    overflow: hidden;
    background: var(--pp-surface-2);
    box-shadow: var(--pp-shadow);
    transition: transform .18s ease, box-shadow .18s ease;
}
.video-grid .position-relative > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease, filter .25s ease, opacity .25s ease;
}

/* dim + play affordance on hover. Same triangle as the detail-page Plyr
   play button (static/img/plyr.svg, #plyr-play), inlined here so the list
   grid doesn't need Plyr/JS just to draw one icon. */
.video-grid .position-relative::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--pp-brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath fill='%23fff' d='M15.562 8.1 3.87.225c-.818-.562-1.87 0-1.87.9v15.75c0 .9 1.052 1.462 1.87.9L15.563 9.9c.584-.45.584-1.35 0-1.8'/%3E%3C/svg%3E") center / 42% no-repeat;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
    opacity: 0;
    transform: scale(.6);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
}
.video-grid a:hover .position-relative {
    transform: translateY(-4px);
    box-shadow: var(--pp-shadow-hover);
}
.video-grid a:hover .position-relative > img {
    transform: scale(1.06);
    filter: brightness(.62);
}
.video-grid a:hover .position-relative::after { opacity: 1; transform: scale(1); }

/* hover preview: animated sample sits on top of the static thumb, fades in on
   hover. Stays undimmed so the clip reads clearly while the card is hovered. */
.video-grid .position-relative > img.thumb-sample {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity .25s ease;
}
.video-grid a:hover .position-relative > img.thumb-sample {
    opacity: 1;
    filter: none;
}
/* once the sample has loaded, fade the static thumb out on hover so the clip
   shows cleanly instead of playing behind a dimmed cover. */
.video-grid a:hover .position-relative.sample-ready > img:not(.thumb-sample) {
    opacity: 0;
}

/* The ?all=1 browse mixes playable rows with catalogue-only ones, and
   promising a play button on a page that has no player is worse than
   offering nothing. */
.video-grid .position-relative.no-play::after { content: none; }
.video-grid a:hover .position-relative.no-play > img { filter: none; }

/* badges: gold = quality, rose = views, keep them crisp over the thumb */
.video-grid .position-relative .bg-warning { background: var(--pp-gold) !important; }
.video-grid .position-relative [class*="bg-"] { font-weight: 600; }

/* badge strip over a thumbnail (quality top-right, duration/views bottom-right).
   The container component and the rose "views" pill carry their sizes/colours
   here so the list templates hold no inline styles. */
.thumb-badges {
    display: inline-flex;
    overflow: hidden;
    border-radius: .375rem;
    font-size: .6rem;
}
/* title: allow two lines instead of a hard single-line truncate */
.video-grid .text-truncate {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.3;
    min-height: 2.6em;
    margin-top: .5rem;
    font-size: .85rem;
    color: var(--pp-text);
}
.video-grid a:hover .text-truncate { color: var(--pp-brand); }
.video-grid .text-truncate + .text-center,
.video-grid .text-center small { color: var(--pp-muted); }

/* ---------- Star grid (portrait avatars) ---------- */
.star-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: clamp(.6rem, .4rem + .6vw, 1rem);
    margin: .75rem 0 1.25rem;
}
.star-grid > * { width: auto; max-width: none; flex: none; margin: 0; padding: 0; }
.star-grid img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: var(--pp-radius);
    box-shadow: var(--pp-shadow);
    transition: transform .18s ease, box-shadow .18s ease;
}
.star-grid a:hover img {
    transform: translateY(-4px);
    box-shadow: var(--pp-shadow-hover);
}
.star-grid .text-truncate { margin-top: .4rem; font-weight: 600; }

/* ---------- Detail page: poster / player ---------- */
/* The content column is flush to the page's side padding, like the listing
   pages -- no inner grid offset. The media is what stays capped and centred. */
.detail-media { margin-bottom: .9rem; }
/* Cap the media so a wide cover or the player doesn't dominate the page.
   flex/min-width: 0 lets it shrink inside .carousel-row alongside the two
   button siblings instead of insisting on its own max-width first. */
.detail-media .carousel { width: 100%; max-width: 900px; margin-inline: auto; flex: 1 1 auto; min-width: 0; }
/* The bare <video> before Plyr wraps it in .plyr (and the no-JS case). */
.detail-media > video {
    width: 100%;
    max-width: 900px;
    aspect-ratio: 16 / 9;
    border-radius: var(--pp-radius);
}
/* Fixed box, not sized per-image: the cover is letterboxed 16:9 already,
   but gallery stills and the sample clip each carry their own native ratio
   -- without a common frame, every slide/swap jumps to a different height.
   object-fit: contain keeps the whole shot in frame (never crops a still),
   filling the rest of the box with black like a real letterboxed player. */
.detail-media img {
    max-width: min(900px, 100%);
    max-height: 78vh;
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    margin-inline: auto;
    border-radius: var(--pp-radius);
    object-fit: contain;
    background: #000;
}
.detail-media .plyr {
    width: 100%;
    max-width: 900px;
    margin-inline: auto;
}
/* Fill the 16:9 frame exactly like list-page thumbnails do (.video-grid
   .position-relative > img, object-fit: cover) instead of Plyr's default
   letterboxing, which showed black bars whenever the real video ratio
   didn't come out to exactly 16:9. */
.detail-media .plyr video { object-fit: cover; }
.detail-media .plyr__poster { background-size: cover; }

/* Related videos -- same grid as the listing pages (.video-grid), just its
   own heading and top gap from whatever sits above it. */
.detail-related { margin-top: 1.75rem; }
.detail-related .video-grid { margin-top: 0; }

/* Telegram subscribe CTA (partials/telegram_cta.html). Bootstrap used to
   style this; now it's a plain bordered strip with real breathing room above
   it so it reads as its own thing, not a footnote to the block before. */
.tg-cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .6rem 1.2rem;
    margin: 2rem 0 .5rem;
    padding: .95rem 1.15rem;
    background: var(--pp-surface);
    border: 1px solid var(--pp-border);
    border-radius: var(--pp-radius-sm);
}
.tg-cta-text {
    margin: 0;
    font-size: .9rem;
    line-height: 1.5;
    color: var(--pp-text);
}
.tg-cta-actions {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    flex-shrink: 0;
}
.tg-cta-more {
    color: var(--pp-brand);
    text-decoration: none;
    font-size: .85rem;
    white-space: nowrap;
}
.tg-cta-more:hover { text-decoration: underline; }

/* Rewind/forward, hand-built in player.js and dropped into the same wrapper
   as Plyr's play-large button. Sit near the two edges (not crowding the
   center play button), no background disc -- just the bare icon, with a
   drop-shadow to stay readable over light or dark footage -- and they
   follow Plyr's own mouse-move/tap-driven controls visibility
   (.plyr--hide-controls) so they show and auto-hide together with the rest
   of the control bar. Faded to half-strength by default so they read as a
   soft affordance rather than two solid buttons sitting on top of the
   footage; hover/focus (and tap, on touch) bring them up to full strength.
   Stay hidden until playback has actually started (player.js adds
   .pp-seek-ready on first `play`) -- before that the video is still
   sitting on the poster at 0:00, so a rewind button has nothing to rewind
   to. */
.pp-seek {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2.75rem;
    height: 2.75rem;
    display: grid;
    place-items: center;
    border: 0;
    background: none;
    color: #fff;
    cursor: pointer;
    z-index: 2;
    opacity: 0;
    pointer-events: none;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .9)) drop-shadow(0 0 6px rgba(0, 0, 0, .7));
    transition: opacity .2s ease, transform .15s ease;
}
.pp-seek svg { width: 28px; height: 28px; }
.pp-seek-ready .pp-seek { opacity: .5; pointer-events: auto; }
.pp-seek-ready .pp-seek:hover, .pp-seek-ready .pp-seek:focus-visible, .pp-seek-ready .pp-seek:active {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}
.pp-seek--back { left: 8%; }
.pp-seek--fwd { right: 8%; }
.plyr--video.plyr--hide-controls .pp-seek { opacity: 0; pointer-events: none; }

/* Theme Plyr (static/js/plyr.min.js, vendored like hls.min.js) to match the
   brand color instead of its default blue. Plyr builds its own play/progress/
   volume/fullscreen controls and loading spinner and removes the video's
   native `controls` at init time, so there's no separate custom play button
   or native-control-hiding CSS to maintain here anymore. */
.plyr {
    --plyr-color-main: var(--pp-brand);
    --plyr-video-control-color-hover: #fff;
    --plyr-video-control-background-hover: var(--pp-brand-600);
}
/* Plyr's default volume slider (max-width: 90px, min-width: 60px) eats a big
   chunk of the control bar, squeezing the progress/seek track -- the control
   people actually drag -- down to a sliver. Shrink it so seek gets the room. */
.plyr__volume input[type="range"] {
    max-width: 50px;
    min-width: 40px;
}
/* On real pointer devices, go further: collapse the track to nothing behind
   the mute icon and only expand it on hover/focus/drag, YouTube-style. Mute
   button and slider share one .plyr__volume wrapper, so hovering either one
   (or tabbing to the slider) triggers the expand. Gated to (hover: hover)
   and (pointer: fine) because touch has no hover to ever reveal a collapsed
   control -- phones fall through to the always-visible shrink above/below. */
@media (hover: hover) and (pointer: fine) {
    .plyr__volume input[type="range"] {
        max-width: 0;
        min-width: 0;
        opacity: 0;
        margin-left: 0;
        margin-right: 0;
        transition: max-width .15s ease, opacity .15s ease, margin .15s ease;
    }
    .plyr__volume:hover input[type="range"],
    .plyr__volume:focus-within input[type="range"],
    .plyr__volume input[type="range"]:active {
        max-width: 50px;
        opacity: 1;
        margin-left: calc(var(--plyr-control-spacing, 10px) / 2);
        margin-right: calc(var(--plyr-control-spacing, 10px) / 2);
    }
}
/* Touch devices: no hover to ever reveal a collapsed slider, and phones
   already have hardware volume buttons -- the on-screen slider is pure
   overhead there. Drop it and keep just the mute toggle, so the seek/
   progress track (the control that actually matters on a phone) gets all
   the space instead of splitting it with a slider nobody drags. Keyed off
   (hover: none) / (pointer: coarse) rather than viewport width so a narrow
   *desktop* window (still mouse-driven) keeps the collapse-on-hover slider
   above instead of losing it outright. */
@media (hover: none), (pointer: coarse) {
    .plyr__volume input[type="range"] { display: none; }
}
/* Phones: no hover, so the reveal-on-hover list play icon never usefully
   shows and is too glaring on a dense grid — drop it. Tapping a card goes
   straight to the detail page. */
@media (max-width: 575px) {
    .video-grid .position-relative::after { content: none; }
}

/* ---------- Detail page: metadata + chips ---------- */
.meta { margin: 1.1rem 0 .5rem; }
.meta-row {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: .35rem 1rem;
    align-items: start;
    padding: .65rem 0;
    border-top: 1px solid var(--pp-border);
}
.meta-row:last-child { border-bottom: 1px solid var(--pp-border); }
.meta dt {
    color: var(--pp-muted);
    font-size: .76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding-top: .35rem;
}
.meta dd {
    margin: 0;
    color: var(--pp-text);
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    align-items: center;
    min-height: 1.9rem;
}
.meta-id { font-family: "Sora", ui-monospace, monospace; letter-spacing: .04em; }
@media (max-width: 575px) {
    /* Label column stays put -- dt text here (厂商/女优/时长...) is short
       enough that a narrower label column reads fine two-up, and Movie's
       mobile detail page already relies on this same table staying two
       columns rather than stacking (see movie_detail.html). */
    .meta-row { grid-template-columns: 4.5rem 1fr; gap: .2rem .6rem; padding: .55rem 0; }
}

/* taxonomy chips — one loud (actress), one quiet (tags), one accent (source) */
.chip {
    display: inline-flex;
    align-items: center;
    gap: .3em;
    padding: .34rem .72rem;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background .15s ease, border-color .15s ease,
        color .15s ease, transform .12s ease;
}
.chip:hover { transform: translateY(-1px); }
.chip-actress {
    background: var(--pp-brand-soft);
    color: #ffb3cb;
    border-color: color-mix(in srgb, var(--pp-brand) 40%, transparent);
}
.chip-actress::before { content: "\2640"; opacity: .65; }
.chip-actress:hover { background: var(--pp-brand); color: #fff; border-color: var(--pp-brand); }
.chip-tag {
    background: var(--pp-surface-2);
    color: var(--pp-muted);
    border-color: var(--pp-border);
}
.chip-tag:hover { color: var(--pp-text); border-color: var(--pp-brand); }
.chip-genre {
    background: var(--pp-brand-soft);
    color: #ffb3cb;
    border-color: transparent;
}
.chip-genre:hover { background: var(--pp-brand); color: #fff; }

/* ---------- Search results: grouped sections ---------- */
.search-section-title {
    font-family: "Sora", system-ui, sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    margin: 1.4rem 0 .25rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid var(--pp-border);
}
.search-section-title span { font-weight: 500; font-size: .9rem; }

/* chip groups used on mobile detail (no meta table) */
.chip-group { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; width: 100%; }

/* The tag index, where the chips are the page rather than a detail page's
   footer. Only the PC template asks for this -- on a phone the small size is
   what keeps a 76-tag list from becoming a scroll. */
.chip-group-index { gap: .55rem; }
.chip-group-index .chip {
    font-size: 1rem;
    padding: .5rem 1rem;
}

/* ---------- Download table (download_torrents.html, movie_downloads.html) ----------
   Same visual language as the .meta table above it: no outer box, a hairline
   rule between rows, flush to the content column's left edge. */
.downloads { margin: 1.3rem 0 .5rem; }
/* Section headings on the detail page -- "Download", "Related Videos" -- all
   one size. */
.downloads-title,
.section-heading {
    margin: 0 0 .5rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--pp-text);
}
/* Full width so the row rules line up with the .meta table above, but the
   columns are a fixed cluster on the left (via <colgroup>): a 4th, width-less
   <col> soaks up the slack on wide screens so title / magnet / size stay
   close together instead of drifting apart. */
.dl-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.dl-col-name { width: 16rem; }
.dl-col-link { width: 40rem; }
.dl-col-size { width: 6rem; }
.dl-table th,
.dl-table td {
    padding: .7rem 1.25rem .7rem 0;
    text-align: left;
    vertical-align: middle;
    border-top: 1px solid var(--pp-border);
}
.dl-table tr:last-child td { border-bottom: 1px solid var(--pp-border); }
.dl-table th {
    color: var(--pp-muted);
    font-size: .76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.dl-table td { color: var(--pp-text); font-size: .84rem; }
.dl-name { word-break: break-word; }
.dl-size { color: var(--pp-muted); white-space: nowrap; }
/* The magnet/link cell: the <a> text is the full URI, truncated with an
   ellipsis; clicking it copies the URI (ui.js, [data-copy]) rather than
   navigating. Kept a real href so "copy link" / a handler / no-JS still work. */
.dl-copy {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: "Sora", ui-monospace, monospace;
    font-size: .78rem;
    color: var(--pp-muted);
    text-decoration: none;
    cursor: pointer;
    transition: color .12s ease;
}
.dl-copy:hover { color: var(--pp-brand); }
.dl-copy.is-copied { color: var(--pp-brand); font-family: inherit; letter-spacing: 0; }
@media (max-width: 575px) {
    .dl-table th, .dl-table td { padding: .6rem .55rem .6rem 0; }
    .dl-table td { font-size: .8rem; }
    .dl-col-name { width: 6.5rem; }
    .dl-col-link { width: auto; }
    .dl-col-size { width: 3.8rem; }
    .dl-copy { font-size: .72rem; }
}

/* ---------- Auth pages (sign in / sign up / verify) ---------- */
.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}
.auth-card {
    width: 100%;
    max-width: 380px;
    padding: 2rem 1.75rem 1.75rem;
    background: var(--pp-surface);
    border: 1px solid var(--pp-border);
    border-radius: var(--pp-radius);
    box-shadow: var(--pp-shadow);
    text-align: center;
}
.auth-card .brand { font-size: 1.5rem; margin-bottom: 1.5rem; }
.auth-card h1 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}
.auth-card .form-floating { text-align: left; }
.auth-card .btn-danger {
    --bs-btn-padding-y: .6rem;
    --bs-btn-font-size: 1rem;
    font-weight: 600;
}
.auth-link { color: var(--pp-brand); text-decoration: none; font-weight: 600; }
.auth-link:hover { color: var(--pp-brand-600); }
.auth-home { color: var(--pp-muted); text-decoration: none; font-size: .85rem; }
.auth-home:hover { color: var(--pp-text); }

footer { border-color: var(--pp-border) !important; color: var(--pp-muted); }

/* ---------- Novel list ---------- */
.novel-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: .5rem;
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;   /* room before the pager, like the video grid */
}
@media (min-width: 992px) {
    .novel-list { grid-template-columns: 1fr 1fr; gap: .5rem .75rem; }
}
.novel-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .7rem .9rem;
    border: 1px solid var(--pp-border);
    border-radius: var(--pp-radius-sm);
    background: var(--pp-surface);
    color: var(--pp-text);
    text-decoration: none;
    transition: background .15s, border-color .15s;
}
.novel-link:hover {
    background: var(--pp-surface-2);
    border-color: color-mix(in srgb, var(--pp-brand) 55%, transparent);
    color: var(--pp-text);
}
.novel-icon { flex: 0 0 auto; color: var(--pp-brand); opacity: .85; }
.novel-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .95rem;
}
.nt-name { color: var(--pp-text); font-weight: 600; }
.nt-meta { color: var(--pp-muted); font-weight: 400; }
.nt-tag {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    color: var(--pp-brand);
    background: var(--pp-brand-soft);
    border-radius: 999px;
    padding: .05rem .5rem;
    margin-right: .35rem;
    vertical-align: middle;
}
/* Phones: too narrow for one-line ellipsis — wrap to 2 lines and tighten. */
@media (max-width: 575px) {
    .novel-link { align-items: flex-start; gap: .5rem; padding: .6rem .7rem; }
    .novel-icon { margin-top: .15rem; }
    .novel-title {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        font-size: .9rem;
        line-height: 1.35;
    }
}

/* ---------- Novel detail (reading view) ---------- */
.novel-article {
    /* Flush to the content column like every other page. Still capped so a
       CJK line on a wide monitor doesn't run the full width. */
    max-width: 62rem;
    margin: 0;
}
.novel-heading {
    font-size: 1.4rem;
    line-height: 1.45;
    margin: 0 0 .9rem;
    padding-bottom: .9rem;
    border-bottom: 1px solid var(--pp-border);
}
.novel-body {
    font-size: 1.06rem;
    color: var(--pp-text);
}
.novel-body p {
    line-height: 1.95;
    margin: 0 0 1.1rem;
    text-indent: 2em;   /* CJK paragraph convention */
}
@media (max-width: 575px) {
    .novel-heading { font-size: 1.2rem; }
    .novel-body { font-size: 1.02rem; }
    .novel-body p { line-height: 1.9; margin-bottom: 1rem; }
}

/* ---------- Accessibility / motion ---------- */
a:focus-visible, .btn:focus-visible {
    outline: 2px solid var(--pp-brand);
    outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
    .video-grid .position-relative,
    .video-grid .position-relative > img,
    .video-grid .position-relative::after,
    .star-grid img { transition: none; }
    .video-grid a:hover .position-relative > img { transform: none; }
}
