/* Short Drama Core — 播放页样式（与主题解耦，全部 sd- 前缀） */

/* 变量挂到每个组件上，保证在 Elementor 页面（无 .sd-main 容器）里同样生效 */
.sd-main,
.sd-stage,
.sd-player,
.sd-paywall,
.sd-episodes,
.sd-dramas {
	--sd-bg: #0b0b0f;
	--sd-surface: #15151c;
	--sd-border: rgba(255, 255, 255, 0.09);
	--sd-text: #f4f4f6;
	--sd-muted: #9a9aa8;
	--sd-accent: #ff2d55;
	--sd-radius: 14px;
}

.sd-main {
	display: block;
	max-width: 1180px;
	margin: 0 auto;
	padding: 28px 20px 64px;
	color: var(--sd-text);
}

.sd-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 300px;
	gap: 24px;
	align-items: start;
}

@media (max-width: 900px) {
	.sd-layout {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* 播放器 */
.sd-stage {
	position: relative;
	background: #000;
	border-radius: var(--sd-radius);
	overflow: hidden;
	border: 1px solid var(--sd-border);
}

.sd-player {
	position: relative;
	width: 100%;
	aspect-ratio: 9 / 16;
	max-height: 72vh;
	background: #000;
	/* 盒子必须自己夹住 iframe。只要高度被算成 0（旧浏览器不认 aspect-ratio、
	   Elementor 或缓存插件把这段 CSS 优化掉），绝对定位的 iframe 就会溢出到下面
	   的内容上 —— 手机上看到的就是「视频浮在页面上、挡住选集、页面翻不动」。 */
	overflow: hidden;
	contain: paint;
}

/* 手机：9:16 加 max-height 会吃掉大半个屏幕，手指一滑正好落在视频上，整页就翻不动。
   改成 150%（约 2:3）的固定盒子，下面留出可以滑动的位置；
   并且用 padding 撑高度而不是 aspect-ratio —— 老版 iOS Safari / 安卓 WebView
   不支持 aspect-ratio 时，容器高度会是 0，也就是上面说的「浮起来」。 */
@media (max-width: 767px) {
	.sd-player {
		height: 0;
		padding-top: 150%;
		aspect-ratio: auto;
		max-height: none;
	}
}

.sd-player__frame {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* 直链视频（mp4 / m3u8）用原生 video 播，才能拿到 ended 事件做自动连播 */
.sd-player__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	background: #000;
	object-fit: contain;
	outline: none;
}

/* 播完后的续播卡片：盖在画面上，不重建播放器 */
.sd-upnext {
	position: absolute;
	inset: 0;
	z-index: 6;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 24px 18px;
	text-align: center;
	background: radial-gradient(circle at 50% 35%, rgba(26, 26, 36, 0.88), rgba(6, 6, 10, 0.95));
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
}

/* 「点击播放」这种提示不该遮住画面 */
.sd-upnext.is-tap {
	justify-content: flex-end;
	padding-bottom: 28px;
	background: linear-gradient(to top, rgba(6, 6, 10, 0.78), rgba(6, 6, 10, 0) 45%);
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
}

.sd-upnext__hint {
	margin: 0;
	font-size: 12px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.62);
}

.sd-upnext__title {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.4;
	color: #fff;
}

.sd-upnext__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
	margin-top: 8px;
}

.sd-upnext .sd-btn {
	min-width: 108px;
	padding: 10px 20px;
	font-size: 14px;
	text-align: center;
}

@media (max-width: 480px) {
	.sd-upnext {
		gap: 6px;
		padding: 18px 14px;
	}

	.sd-upnext__title {
		font-size: 17px;
	}

	.sd-upnext__actions {
		gap: 8px;
	}

	.sd-upnext .sd-btn {
		min-width: 0;
		padding: 9px 14px;
		font-size: 13px;
	}
}

/* iframe 托管商不报「播完」时，右上角常驻一个下一集按钮兜底 */
.sd-nextpill {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 5;
	margin: 0;
	padding: 7px 13px;
	border: 1px solid rgba(255, 255, 255, 0.24);
	border-radius: 999px;
	background: rgba(8, 8, 12, 0.6);
	color: #fff;
	font-size: 12px;
	line-height: 1;
	cursor: pointer;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

/* 全屏时右上角让给退出按钮 */
body.sd-theater-on .sd-nextpill {
	top: 12px;
	right: 108px;
}

.sd-player__loading,
.sd-player__error {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	color: var(--sd-muted);
	font-size: 14px;
	background: radial-gradient(circle at 50% 40%, #1a1a24 0%, #08080b 70%);
}

.sd-spinner {
	width: 26px;
	height: 26px;
	border: 2px solid rgba(255, 255, 255, 0.18);
	border-top-color: #fff;
	border-radius: 50%;
	animation: sd-spin 0.8s linear infinite;
}

@keyframes sd-spin {
	to {
		transform: rotate(360deg);
	}
}

/* 付费墙 */
.sd-paywall {
	position: relative;
	min-height: 420px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px 24px;
	background:
		linear-gradient(180deg, rgba(8, 8, 11, 0.2), rgba(8, 8, 11, 0.95)),
		radial-gradient(circle at 30% 20%, #2a1620 0%, #0a0a0e 60%);
}

.sd-paywall__inner {
	max-width: 380px;
	text-align: center;
}

.sd-paywall__badge {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 999px;
	background: rgba(255, 45, 85, 0.16);
	color: var(--sd-accent);
	font-size: 12px;
	letter-spacing: 0.04em;
}

.sd-paywall__title {
	margin: 14px 0 8px;
	font-size: 22px;
	line-height: 1.35;
	color: #fff;
}

.sd-paywall__desc {
	margin: 0 0 22px;
	color: var(--sd-muted);
	font-size: 14px;
	line-height: 1.7;
}

.sd-paywall__login {
	margin: 14px 0 0;
	font-size: 13px;
}

.sd-paywall__login a {
	color: var(--sd-muted);
	text-decoration: underline;
}

/* 按钮 */
.sd-btn {
	display: inline-block;
	padding: 12px 26px;
	border-radius: 999px;
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
	transition: transform 0.15s ease, opacity 0.15s ease;
}

.sd-btn--primary {
	background: var(--sd-accent, #ff2d55);
	color: #fff;
}

.sd-btn--primary:hover {
	transform: translateY(-1px);
	opacity: 0.92;
	color: #fff;
}

/* 次要按钮：续播卡片里的「重播 / 取消自动连播」 */
.sd-btn--ghost {
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.24);
	color: #fff;
}

.sd-btn--ghost:hover {
	background: rgba(255, 255, 255, 0.18);
	color: #fff;
	transform: translateY(-1px);
}

/* 播放条 */
.sd-stage__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 4px 0;
}

.sd-stage__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.sd-chip {
	display: inline-block;
	padding: 5px 11px;
	border: 1px solid var(--sd-border);
	border-radius: 999px;
	font-size: 12px;
	color: var(--sd-muted);
	text-decoration: none;
}

.sd-chip--link:hover {
	color: var(--sd-text);
	border-color: rgba(255, 255, 255, 0.28);
}

.sd-next {
	font-size: 14px;
	color: var(--sd-text);
	text-decoration: none;
	white-space: nowrap;
}

/* 上一集贴左，下一集贴右 */
.sd-stage__bar .sd-next:first-child {
	margin-right: auto;
}

.sd-stage__bar .sd-next + .sd-next {
	margin-left: auto;
}

.sd-next:hover {
	color: var(--sd-accent);
}

/* 侧栏 */
.sd-side {
	background: var(--sd-surface);
	border: 1px solid var(--sd-border);
	border-radius: var(--sd-radius);
	padding: 22px;
}

.sd-title {
	margin: 0 0 12px;
	font-size: 20px;
	line-height: 1.4;
	color: #fff;
}

.sd-synopsis {
	margin: 0 0 16px;
	font-size: 14px;
	line-height: 1.75;
	color: var(--sd-muted);
}

.sd-side__cta {
	margin-top: 18px;
}

.sd-side__hint {
	margin: 10px 0 0;
	font-size: 12px;
	color: var(--sd-muted);
}

/* 选集 */
.sd-episodes {
	margin-top: 34px;
}

.sd-episodes__head {
	display: flex;
	align-items: baseline;
	gap: 10px;
	margin-bottom: 16px;
}

.sd-episodes__head h2 {
	margin: 0;
	font-size: 17px;
	color: #fff;
}

.sd-episodes__count {
	font-size: 13px;
	color: var(--sd-muted);
}

.sd-episodes__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
	gap: 10px;
}

.sd-ep {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1 / 1;
	border-radius: 10px;
	border: 1px solid var(--sd-border);
	background: var(--sd-surface);
	color: var(--sd-text);
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	text-decoration: none;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.sd-ep:hover {
	border-color: rgba(255, 255, 255, 0.3);
	background: #1d1d26;
}

.sd-ep.is-locked {
	color: var(--sd-muted);
	background: rgba(255, 255, 255, 0.02);
}

/* 会员：已解锁但不是免费集，低调一点，别和免费集抢注意力 */
.sd-ep.is-member {
	color: var(--sd-text);
	background: rgba(255, 255, 255, 0.05);
}

.sd-ep.is-active {
	border-color: var(--sd-accent);
	background: rgba(255, 45, 85, 0.12);
	color: #fff;
}

.sd-ep__lock {
	position: absolute;
	top: 5px;
	right: 6px;
	font-size: 9px;
	opacity: 0.75;
}

.sd-notice {
	padding: 80px 24px;
	text-align: center;
	color: var(--sd-muted);
}

/* 容器不继承主题的奇怪边框 */
.sd-main a {
	box-shadow: none;
}

/* 剧目列表 [sd_dramas] */
.sd-dramas {
	display: block;
	width: 100%;
}

.sd-dramas__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 18px;
}

.sd-card {
	display: block;
	text-decoration: none;
	color: var(--sd-text);
	box-shadow: none;
}

.sd-card__poster {
	display: block;
	aspect-ratio: 3 / 4;
	border-radius: 12px;
	overflow: hidden;
	background: var(--sd-surface);
	border: 1px solid var(--sd-border);
	transition: transform 0.18s ease, border-color 0.18s ease;
}

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

.sd-card:hover .sd-card__poster {
	transform: translateY(-3px);
	border-color: rgba(255, 255, 255, 0.28);
}

.sd-card__title {
	display: block;
	margin-top: 9px;
	font-size: 14px;
	line-height: 1.4;
	color: var(--sd-text);
}

.sd-card__meta {
	display: block;
	margin-top: 2px;
	font-size: 12px;
	color: var(--sd-muted);
}

/* 侧栏海报 */
.sd-side__poster {
	margin: 0 0 14px;
	border-radius: 12px;
	overflow: hidden;
	aspect-ratio: 3 / 4;
	background: var(--sd-surface);
	border: 1px solid var(--sd-border);
}

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

/* 没有封面时的文字占位，避免卡片塌陷 */
.sd-card__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 16px;
	text-align: center;
	font-size: 14px;
	line-height: 1.5;
	color: rgba(255, 255, 255, 0.75);
	background:
		radial-gradient(circle at 30% 20%, rgba(255, 45, 85, 0.28), transparent 55%),
		linear-gradient(160deg, #1c1c26 0%, #0d0d12 100%);
}

.sd-card__placeholder span {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* 题材标签组（[sd_genres]） */
.sd-genres {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 14px;
}

/* 封面容器（[sd_cover]）。默认类 sd-side__poster 已有尺寸，这里只兜底 */
.sd-cover {
	display: block;
	overflow: hidden;
	border-radius: var(--sd-radius, 14px);
}

.sd-cover img {
	display: block;
	width: 100%;
	height: auto;
}

/* 目录分页（[sd_dramas paged="1"]） */
.sd-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-top: 26px;
}

.sd-pagination a,
.sd-pagination > span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	border: 1px solid var(--sd-border, rgba(255, 255, 255, 0.09));
	border-radius: 10px;
	font-size: 13px;
	color: var(--sd-muted, #9a9aa8);
	text-decoration: none;
}

.sd-pagination a:hover {
	color: var(--sd-text, #f4f4f6);
	border-color: rgba(255, 255, 255, 0.28);
}

.sd-pagination > span.current {
	color: #fff;
	background: var(--sd-accent, #ff2d55);
	border-color: transparent;
}

.sd-pagination > span.dots {
	border-color: transparent;
}

/* 播放量（[sd_views]） */
.sd-views {
	display: inline-block;
	font-size: 12px;
	color: var(--sd-muted, #9a9aa8);
}

/* 全屏观看：把播放器整块固定到视口，iframe 不搬动，视频不会重新加载 */
.sd-theater-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 10px;
	padding: 7px 14px;
	border: 1px solid var(--sd-border, rgba(255, 255, 255, 0.09));
	border-radius: 999px;
	background: transparent;
	color: var(--sd-muted, #9a9aa8);
	font: inherit;
	font-size: 13px;
	line-height: 1.2;
	cursor: pointer;
	transition: color 0.15s ease, border-color 0.15s ease;
}

.sd-theater-toggle:hover {
	color: var(--sd-text, #f4f4f6);
	border-color: rgba(255, 255, 255, 0.28);
}

.sd-theater-toggle__ico {
	font-size: 14px;
	line-height: 1;
}

.sd-player.is-theater {
	position: fixed !important;
	inset: 0 !important;
	width: 100% !important;
	height: 100% !important;
	height: 100dvh !important;
	max-height: none !important;
	margin: 0 !important;
	padding-top: 0 !important;
	aspect-ratio: auto !important;
	border-radius: 0 !important;
	background: #000 !important;
	z-index: 2147483000 !important;
}

/* 进入全屏后按钮浮到右上角，当关闭键用 */
.sd-player.is-theater ~ .sd-theater-toggle,
body.sd-theater-on .sd-theater-toggle {
	position: fixed;
	top: 12px;
	right: 12px;
	z-index: 2147483001;
	margin: 0;
	padding: 8px 14px;
	color: #fff;
	background: rgba(0, 0, 0, 0.55);
	border-color: rgba(255, 255, 255, 0.35);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

body.sd-theater-on {
	overflow: hidden;
}
