/* =========================================================
 * LTC 弹幕模块样式（暗色主题，独立文件，不改动引擎 UI）
 * 层级：背景 → 人物 → CG → 【弹幕层】 → 对话框 → 系统UI → 【评论输入】
 * 弹幕层 pointer-events:none，不阻挡剧情点击。
 * ========================================================= */

/* ── 弹幕层与单条弹幕 ───────────────────────────── */
#ltc-danmaku-layer {
	position: absolute;
	inset: 0;
	overflow: hidden;
	pointer-events: none;       /* 关键：不拦截点击推进剧情 */
	z-index: 60;                /* 位于 visuals/text-box 之下 */
	contain: strict;
}

.ltc-danmaku {
	position: absolute;
	left: 0;
	white-space: nowrap;
	color: #ffffff;
	font-weight: 600;
	line-height: 1.3;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85), 0 0 2px rgba(0, 0, 0, 0.6);
	will-change: transform;
	user-select: none;
	padding: 2px 6px;
	border-radius: 4px;
	background: rgba(0, 0, 0, 0.18);
}

/* ── 常驻弹幕开关按钮 ──────────────────────────── */
#ltc-danmaku-toggle {
	position: fixed;
	top: 10px;
	right: 10px;
	z-index: 9000;
	min-width: 44px;
	min-height: 32px;
	padding: 4px 12px;
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: 16px;
	background: rgba(20, 20, 30, 0.7);
	color: #f8f8f2;
	font-size: 13px;
	cursor: pointer;
	pointer-events: auto;
	backdrop-filter: blur(4px);
}
#ltc-danmaku-toggle:hover { background: rgba(40, 40, 60, 0.85); }
#ltc-danmaku-toggle.on { background: rgba(80, 250, 123, 0.9); color: #0a1f12; border-color: rgba(80, 250, 123, 0.9); font-weight: 700; }

/* 注入到引擎「游戏设置页」的弹幕开关行 */
.ltc-settings-page-row {
	width: 100%;
	max-width: 320px;
	margin: 0.6em auto;
	padding: 0.5em 0.4em;
	color: #f8f8f2;
}

/* ── 评论按钮 ──────────────────────────────────── */
#ltc-danmaku-comment-btn {
	position: fixed;
	left: 12px;
	bottom: 56px;
	z-index: 9000;
	min-width: 44px;
	min-height: 40px;
	padding: 6px 16px;
	border: none;
	border-radius: 20px;
	background: linear-gradient(135deg, #ff7eb3, #ff758c);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	pointer-events: auto;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ── 设置浮层 ──────────────────────────────────── */
#ltc-danmaku-settings {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: none;              /* 由 JS 切换为 flex */
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.55);
	pointer-events: auto;
}
.ltc-danmaku-settings-card {
	width: min(90vw, 340px);
	padding: 18px 20px;
	border-radius: 14px;
	background: #1b1b26;
	color: #f8f8f2;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.ltc-danmaku-settings-title {
	font-size: 17px;
	font-weight: 700;
	margin-bottom: 14px;
	text-align: center;
}
.ltc-danmaku-settings-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 0;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.ltc-danmaku-settings-row > span { font-size: 14px; }

.ltc-danmaku-switch {
	min-width: 52px;
	min-height: 30px;
	border: none;
	border-radius: 15px;
	background: #444;
	color: #ccc;
	font-size: 13px;
	cursor: pointer;
}
.ltc-danmaku-switch.on { background: #50fa7b; color: #0a1f12; font-weight: 700; }

.ltc-danmaku-segment {
	display: inline-flex;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 8px;
	overflow: hidden;
}
.ltc-danmaku-segment button {
	min-width: 40px;
	min-height: 30px;
	border: none;
	background: transparent;
	color: #ccc;
	font-size: 13px;
	cursor: pointer;
	padding: 0 10px;
}
.ltc-danmaku-segment button.active { background: #6272a4; color: #fff; }

.ltc-danmaku-settings-close {
	margin-top: 16px;
	width: 100%;
	min-height: 40px;
	border: none;
	border-radius: 10px;
	background: #44475a;
	color: #f8f8f2;
	font-size: 14px;
	cursor: pointer;
}

/* ── 评论输入（底部 Sheet） ────────────────────── */
#ltc-danmaku-input-overlay {
	position: fixed;
	inset: 0;
	z-index: 9998;
	display: none;              /* JS 切换 flex */
	align-items: flex-end;
	justify-content: center;
	background: rgba(0, 0, 0, 0.45);
	pointer-events: auto;
}
.ltc-danmaku-input-sheet {
	width: min(100vw, 560px);
	background: #1b1b26;
	color: #f8f8f2;
	border-radius: 16px 16px 0 0;
	padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
	box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.5);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.ltc-danmaku-input-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 10px;
}
.ltc-danmaku-input-head > span { font-size: 15px; font-weight: 600; }
.ltc-danmaku-input-close {
	border: none;
	background: transparent;
	color: #bbb;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	min-width: 44px;
	min-height: 44px;
}
.ltc-danmaku-input-text {
	width: 100%;
	min-height: 72px;
	resize: none;
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 10px;
	background: #12121a;
	color: #f8f8f2;
	font-size: 15px;
	padding: 10px 12px;
	box-sizing: border-box;
	font-family: inherit;
}
.ltc-danmaku-input-counter {
	text-align: right;
	font-size: 12px;
	color: #888;
	margin: 4px 2px 10px;
}
.ltc-danmaku-input-send {
	width: 100%;
	min-height: 44px;
	border: none;
	border-radius: 10px;
	background: linear-gradient(135deg, #ff7eb3, #ff758c);
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
}
.ltc-danmaku-input-send:disabled { opacity: 0.6; cursor: default; }

/* ── Toast ─────────────────────────────────────── */
#ltc-danmaku-toast {
	position: fixed;
	left: 50%;
	bottom: 90px;
	transform: translateX(-50%);
	z-index: 10000;
	max-width: 80vw;
	padding: 10px 18px;
	border-radius: 20px;
	background: rgba(0, 0, 0, 0.82);
	color: #fff;
	font-size: 14px;
	text-align: center;
	display: none;
	opacity: 0;
	transition: opacity 0.3s ease;
	pointer-events: none;
}

/* ── 状态提示（loading/empty/error） ───────────── */
#ltc-danmaku-status {
	position: absolute;
	left: 50%;
	bottom: 12%;
	transform: translateX(-50%);
	z-index: 61;
	padding: 6px 14px;
	border-radius: 14px;
	background: rgba(0, 0, 0, 0.5);
	color: #eee;
	font-size: 13px;
	display: none;
	pointer-events: none;
}
#ltc-danmaku-status[data-kind="error"] { color: #ffb4b4; }
#ltc-danmaku-status[data-kind="empty"] { color: #cfcfcf; }

/* ── 轻提示（关闭状态引导开启） ────────────────── */
#ltc-danmaku-hint {
	position: absolute;
	left: 50%;
	top: 12%;
	transform: translateX(-50%);
	z-index: 62;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 14px;
	border-radius: 20px;
	background: rgba(20, 20, 30, 0.8);
	color: #f8f8f2;
	font-size: 14px;
	pointer-events: auto;
	cursor: pointer;
}
#ltc-danmaku-hint button {
	border: none;
	border-radius: 14px;
	background: #50fa7b;
	color: #0a1f12;
	font-weight: 700;
	font-size: 13px;
	padding: 4px 12px;
	min-height: 32px;
	cursor: pointer;
}

/* ── 移动端优化 ────────────────────────────────── */
@media (max-width: 62em) {
	.ltc-danmaku { font-size: 14px !important; }
	#ltc-danmaku-comment-btn { bottom: 64px; left: 10px; padding: 6px 14px; }
	#ltc-danmaku-hint { top: 9%; font-size: 13px; padding: 7px 12px; }
	#ltc-danmaku-status { bottom: 14%; }
}
