/* hullqin-recorder 通用样式 — 经典企业 SaaS 风格 */

:root {
	/* 中性 */
	--bg: #ffffff;
	--bg-subtle: #f5f7fa;
	--surface: #ffffff;
	--border: #e5e7eb;
	--border-strong: #d1d5db;
	--fg: #111827;
	--fg-muted: #6b7280;
	--fg-subtle: #9ca3af;

	/* 品牌色(稳重蓝) */
	--primary: #1d4ed8;
	--primary-hover: #1e40af;
	--primary-soft: #eff6ff;
	--primary-fg: #ffffff;

	/* 状态色 */
	--danger: #dc2626;
	--danger-hover: #b91c1c;
	--danger-soft: #fef2f2;
	--warning: #ca8a04;
	--warning-soft: #fef9c3;
	--success: #15803d;
	--success-soft: #f0fdf4;

	/* 圆角/阴影/字体 */
	--radius: 8px;
	--radius-sm: 6px;
	--shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
	--shadow:
		0 1px 2px rgba(17, 24, 39, 0.06), 0 4px 12px rgba(17, 24, 39, 0.04);
	--shadow-active: 0 0 0 3px rgba(29, 78, 216, 0.18);
	--mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* H5: dark mode 手动切换支持。
   优先级:用户选择 > 系统偏好 > light 默认。
   选择后写入 localStorage('theme'),可选 'light' | 'dark' | 'system'。 */
:root[data-theme="dark"] {
	--bg: #0f172a;
	--bg-subtle: #1e293b;
	--surface: #1e293b;
	--border: #334155;
	--border-strong: #475569;
	--fg: #f1f5f9;
	--fg-muted: #94a3b8;
	--fg-subtle: #64748b;
	--primary: #3b82f6;
	--primary-hover: #60a5fa;
	--primary-soft: #1e3a8a;
	--primary-fg: #ffffff;
	--danger: #ef4444;
	--danger-hover: #f87171;
	--danger-soft: #450a0a;
	--warning: #facc15;
	--warning-soft: #422006;
	--success: #22c55e;
	--success-soft: #052e16;
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme]) {
		--bg: #0f172a;
		--bg-subtle: #1e293b;
		--surface: #1e293b;
		--border: #334155;
		--border-strong: #475569;
		--fg: #f1f5f9;
		--fg-muted: #94a3b8;
		--fg-subtle: #64748b;
		--primary: #3b82f6;
		--primary-hover: #60a5fa;
		--primary-soft: #1e3a8a;
		--primary-fg: #ffffff;
		--danger: #ef4444;
		--danger-hover: #f87171;
		--danger-soft: #450a0a;
		--warning: #facc15;
		--warning-soft: #422006;
		--success: #22c55e;
		--success-soft: #052e16;
	}
}

* {
	box-sizing: border-box;
}

/* [hidden] global safety net: HTML's hidden attr is supposed to equal
   display:none, but our author rules for .filter-toggle / .filter-form /
   .create-form set display: inline-flex/block which override the UA
   stylesheet and leak controls that should be hidden for anonymous users.
   See commit 1f121e6 "fix(ui): hide anonymous history filters". */
[hidden] {
	display: none !important;
}

body {
	margin: 0;
	padding: 0;
	background: var(--bg);
	color: var(--fg);
	font:
		14px/1.4 -apple-system,
		BlinkMacSystemFont,
		"Helvetica Neue",
		"PingFang SC",
		"Hiragino Sans GB",
		"Microsoft YaHei",
		sans-serif;
	min-height: 100vh;
}

header {
	border-bottom: 1px solid var(--border);
	background: var(--surface);
	padding: 12px 24px;
	display: flex;
	align-items: baseline;
	gap: 16px;
}

header h1 {
	font-size: 18px;
	margin: 0;
	font-weight: 600;
}

header .tag {
	font-size: 11px;
	color: var(--fg-muted);
	font-family: var(--mono);
}

main {
	padding: 24px;
	max-width: 1280px;
	margin: 0 auto;
}

section {
	margin-bottom: 32px;
}

section > h2 {
	font-size: 14px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--fg-muted);
	margin: 0 0 12px;
	border-bottom: 1px solid var(--border);
	padding-bottom: 6px;
}

.empty {
	padding: 32px;
	text-align: center;
	color: var(--fg-muted);
	border: 1px dashed var(--border-strong);
	border-radius: var(--radius);
}

/* 单行 inline 提示:用于 0 条折叠场景(P2-4 活跃录制),保留 muted 色但去掉虚线框。
   <p> 标签天然 block,无需 display;padding 压到 10px 0,跟同行 section 节奏一致。 */
.empty-inline {
	margin: 0;
	padding: 10px 0;
	font-size: 13px;
	color: var(--fg-muted);
}
.empty-inline a {
	color: var(--accent);
	text-decoration: none;
}
.empty-inline a:hover {
	text-decoration: underline;
}

/* form */
form {
	display: flex;
	gap: 8px;
	align-items: center;
}

input[type="text"] {
	flex: 1;
	padding: 6px 10px;
	font-size: 14px;
	font-family: var(--mono);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--fg);
}

input[type="text"]:focus {
	outline: 2px solid var(--primary);
	outline-offset: -1px;
}

button {
	padding: 6px 14px;
	font-size: 13px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--fg);
	cursor: pointer;
	transition: all 0.1s ease;
	white-space: nowrap;
}

button:hover {
	background: var(--border);
}

button.primary {
	background: var(--primary);
	color: white;
	border-color: var(--primary);
}

button.primary:hover {
	background: var(--primary-hover);
	border-color: var(--primary-hover);
}

button.danger {
	background: var(--danger);
	color: white;
	border-color: var(--danger);
}

button.danger:hover {
	background: var(--danger-hover);
	border-color: var(--danger-hover);
}

button:disabled {
	color: var(--fg-subtle);
	opacity: 0.7;
	cursor: not-allowed;
}

/* card */
.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 12px 16px;
	box-shadow: var(--shadow);
	margin-bottom: 8px;
}
/* B17: card 选中视觉反馈 —— 用 :has 检测 input[data-action="select"]:checked,
   现代浏览器(Safari 15.4+, Chrome 105+, Firefox 121+)原生支持;
   兜底用 JS toggle .selected class(@supports not 块) */
.card:has(input[data-action="select"]:checked) {
	background: var(--primary-soft);
	border-color: var(--primary);
}
.card:has(input[data-action="select"]:checked) .row {
	/* 选中时高亮一点 */
}
@supports not selector(:has(*)) {
	.card.selected {
		background: var(--primary-soft);
		border-color: var(--primary);
	}
}

.card .row {
	display: flex;
	gap: 16px;
	align-items: center;
}

.card .meta {
	display: flex;
	gap: 16px;
	font-family: var(--mono);
	font-size: 12px;
	color: var(--fg-muted);
	flex-wrap: wrap;
}

.card .meta b {
	color: var(--fg);
	font-weight: 600;
}

.card .players {
	font-size: 13px;
}

.card .players span {
	display: inline-block;
	padding: 2px 6px;
	background: var(--border);
	border-radius: var(--radius);
	margin-right: 4px;
	margin-bottom: 4px;
	font-size: 12px;
}

.status-dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	vertical-align: middle;
	margin-right: 4px;
}

.status-recording {
	background: var(--success);
}
.status-incomplete {
	background: var(--danger);
}
.status-ended {
	background: var(--fg-muted);
}
.status-connecting {
	background: var(--warning);
}

/* replay page */
.replay-shell {
	display: grid;
	grid-template-rows: auto minmax(0, 1fr) auto;
	height: 100vh;
	overflow: hidden;
}

.replay-summary {
	padding: 8px 16px;
	border-bottom: 1px solid var(--border);
	background: var(--surface);
	font-size: 12px;
	font-family: var(--mono);
	display: flex;
	gap: 16px;
	align-items: center;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.replay-summary-current {
	flex: 1;
	color: var(--fg-muted);
	overflow: hidden;
	text-overflow: ellipsis;
}

.replay-summary-right {
	margin-left: auto;
	display: flex;
	gap: 16px;
	align-items: center;
}

.replay-status-label {
	color: var(--fg-muted);
	font-weight: 600;
}

.replay-summary-action {
	padding: 2px 10px;
	font-size: 12px;
}

.replay-lang-toggle {
	margin-right: 6px;
	font-size: 11px;
	font-weight: 600;
}

.replay-export-browser {
	padding: 2px 8px;
	font-size: 11px;
}

.replay-export-status {
	min-height: 1.25rem;
	color: var(--fg-muted);
	font-size: 12px;
}

.replay-export-status.is-error {
	color: var(--danger);
}

.replay-back {
	font-size: 12px;
	color: var(--fg-muted);
	text-decoration: none;
}
.replay-back:hover {
	text-decoration: underline;
}

.replay-main {
	display: grid;
	grid-template-columns: 1fr 320px;
	min-height: 0;
	overflow: hidden;
}

.replay-iframe-wrap {
	position: relative;
	border-top: 1px solid var(--border);
	border-right: 1px solid var(--border);
	background: white;
	min-height: 0;
	cursor: not-allowed;
	overflow: hidden;
}

/* 回放态：iframe 内部所有按钮失活，避免误操作 */
.replay-iframe-wrap iframe {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
	pointer-events: none;
	user-select: none;
}

/* iframe 加载前的占位：避免出现“中间空白” */
.replay-iframe-loading {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	gap: 12px;
	align-items: center;
	justify-content: center;
	background: var(--surface);
	color: var(--fg-muted);
	font-size: 13px;
	pointer-events: none;
	transition: opacity 0.25s ease;
}
.replay-iframe-loading.hidden {
	opacity: 0;
	pointer-events: none;
}
.replay-iframe-loading .spinner {
	width: 28px;
	height: 28px;
	border: 3px solid var(--border);
	border-top-color: var(--primary);
	border-radius: 50%;
	animation: replay-spin 0.9s linear infinite;
}
@keyframes replay-spin {
	to {
		transform: rotate(360deg);
	}
}

/* L4: 角落标识 — 移动端单行省略 */
.replay-iframe-wrap::after {
	/* 默认中文; html lang=en 时被 :lang(en) 规则覆盖 */
	content: "回放中 · 操作已禁用";
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 1;
	max-width: calc(100% - 16px);
	padding: 4px 10px;
	font-size: 11px;
	color: var(--fg-muted);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	pointer-events: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.replay-sidebar {
	border-top: 1px solid var(--border);
	background: var(--surface);
	display: flex;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
}

.replay-sidebar-header {
	padding: 8px 12px;
	border-bottom: 1px solid var(--border);
	font-size: 12px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-shrink: 0;
}

.replay-sidebar-title {
	font-weight: 600;
}

.replay-sidebar-toggle {
	font-size: 11px;
	color: var(--fg-muted);
	display: inline-flex;
	align-items: center;
	gap: 4px;
	cursor: pointer;
}

.replay-sidebar-list {
	flex: 1;
	overflow-y: auto;
	padding: 4px 0;
}

.replay-sidebar-empty {
	padding: 20px;
	text-align: center;
	color: var(--fg-muted);
	font-size: 12px;
}

.replay-sidebar-item {
	padding: 6px 12px;
	border-left: 3px solid transparent;
	font-size: 13px;
	line-height: 1.5;
	cursor: pointer;
	display: flex;
	gap: 8px;
}

.replay-sidebar-item:hover {
	background: rgba(0, 0, 0, 0.04);
}

.replay-sidebar-item.active {
	border-left-color: var(--primary);
	background: rgba(37, 99, 235, 0.08);
	font-weight: 500;
}

.replay-sidebar-item.is-system {
	color: var(--fg-muted);
	font-style: italic;
}

.replay-sidebar-idx {
	font-family: var(--mono);
	font-size: 11px;
	color: var(--fg-muted);
	flex-shrink: 0;
	min-width: 38px;
}

.replay-sidebar-text {
	flex: 1;
	word-break: break-word;
}

.replay-controls {
	padding: 12px 16px;
	border-top: 1px solid var(--border);
	background: var(--surface);
	display: flex;
	gap: 8px;
	align-items: center;
}

.replay-buttons {
	display: flex;
	gap: 6px;
	align-items: center;
	flex-shrink: 0;
}

.replay-step {
	min-width: 36px;
	min-height: 32px;
	padding: 4px 10px;
	white-space: nowrap;
}

.replay-controls .progress {
	flex: 1;
	min-width: 160px;
	display: flex;
	gap: 8px;
	align-items: center;
	font-family: var(--mono);
	font-size: 12px;
}

.replay-controls input[type="range"] {
	flex: 1;
}

.replay-controls .speed {
	display: flex;
	gap: 4px;
}

.replay-controls .speed button {
	padding: 4px 8px;
	font-size: 12px;
	font-family: var(--mono);
	white-space: nowrap;
}

.replay-controls .speed button.active {
	background: var(--primary);
	color: white;
	border-color: var(--primary);
}

/* 移动端 / 窄屏适配 */
@media (max-width: 768px) {
	/* shell 改纵向流式布局，按内容撑开高度 */
	.replay-shell {
		grid-template-rows: auto auto auto;
	}
	/* 主区域：iframe 固定高度（16:9），侧边栏在下方 */
	.replay-main {
		grid-template-columns: 1fr;
		grid-template-rows: auto auto;
	}
	.replay-iframe-wrap {
		border-right: 0;
		aspect-ratio: 4 / 3;
		width: 100%;
	}
	.replay-sidebar {
		max-height: 40vh;
		border-top: 1px solid var(--border);
	}

	/* 控件栏：纵向布局
     行 1：操作按钮（4 步 + 倍速组）
     行 2：进度条 */
	.replay-controls {
		flex-direction: column;
		align-items: stretch;
		gap: 6px;
		padding: 8px 10px;
	}
	.replay-buttons {
		width: 100%;
		flex-wrap: nowrap;
		justify-content: space-between;
	}
	.replay-controls .progress {
		flex: none;
		width: 100%;
		min-width: 0;
	}

	/* 控件按钮紧凑但仍易点 */
	.replay-step,
	#btn-play {
		min-width: 40px;
		min-height: 38px;
		padding: 4px 6px;
	}
	.replay-controls .speed button {
		padding: 4px 5px;
		font-size: 11px;
	}
	.replay-controls .speed {
		gap: 2px;
	}
	.replay-sidebar-item {
		padding: 4px 8px;
		font-size: 12px;
	}
}

.badge-warn {
	display: inline-block;
	margin-top: 8px;
	padding: 3px 8px;
	background: rgba(202, 138, 4, 0.12);
	color: var(--warning);
	border: 1px solid var(--warning);
	border-radius: 4px;
	font-size: 11px;
	font-weight: 600;
}

@media (prefers-color-scheme: dark) {
	.replay-sidebar-item:hover {
		background: rgba(255, 255, 255, 0.05);
	}
	.replay-sidebar-item.active {
		border-left-color: var(--primary);
		background: rgba(59, 130, 246, 0.18);
	}
}

/* ===== 通用容器 ===== */
.container {
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
	padding: 16px;
}
@media (min-width: 640px) {
	.container {
		padding: 24px 32px;
	}
}

.page-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	position: sticky;
	top: 0;
	z-index: 10;
}
.page-header h1 {
	font-size: 16px;
	font-weight: 600;
	margin: 0;
}
.page-header a.app-brand {
	text-decoration: none;
	color: inherit;
}
.page-header a.app-brand:hover {
	opacity: 0.85;
}
.page-header .header-nav-link {
	font-size: 14px;
	color: var(--fg);
	text-decoration: none;
	padding: 6px 10px;
	border-radius: 6px;
	white-space: nowrap;
}
.page-header .header-nav-link:hover {
	background: var(--bg-subtle);
}
.page-header .header-nav-link[aria-current="page"] {
	font-weight: 600;
	color: var(--accent, var(--link, var(--fg)));
	background: var(--bg-subtle);
}
.page-header .spacer {
	margin-left: auto;
	display: flex;
	gap: 8px;
}

.section-title {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--fg-muted);
	margin: 24px 0 12px;
}
.section-title .count {
	font-family: var(--mono);
	font-size: 11px;
	background: var(--bg-subtle);
	padding: 2px 8px;
	border-radius: 999px;
	color: var(--fg-muted);
}
/* 标题行带操作按钮(历史录制的"高级筛选"入口) */
.section-title--with-actions {
	align-items: center;
	gap: 8px;
}
.section-title--with-actions .section-title-text {
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
}
.section-title--with-actions .section-title-actions {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

/* ===== 通用按钮(覆盖默认 button 样式) ===== */
.btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 36px;
	padding: 0 14px;
	font-size: 13px;
	font-weight: 500;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--fg);
	cursor: pointer;
	transition: all 0.12s ease;
	white-space: nowrap;
}
.btn:hover {
	background: var(--bg-subtle);
}
.btn.primary {
	background: var(--primary);
	color: var(--primary-fg);
	border-color: var(--primary);
}
.btn.primary:hover {
	background: var(--primary-hover);
	border-color: var(--primary-hover);
}
.btn.danger {
	background: var(--surface);
	color: var(--danger);
	border-color: var(--danger);
}
.btn.danger:hover {
	background: var(--danger-soft);
}
.btn.ghost {
	background: transparent;
	border-color: transparent;
}
.btn.ghost:hover {
	background: var(--bg-subtle);
}
.btn.icon {
	width: 36px;
	padding: 0;
	justify-content: center;
}
.btn:disabled {
	color: var(--fg-subtle);
	opacity: 0.7;
	cursor: not-allowed;
}
.btn:disabled.btn.primary,
.btn:disabled.btn.danger {
	color: var(--fg-subtle);
	opacity: 0.55;
}
.btn:focus-visible {
	outline: none;
	box-shadow: var(--shadow-active);
}
@media (max-width: 639px) {
	.btn {
		height: 44px;
		padding: 0 16px;
		font-size: 14px;
	}
	.btn.icon {
		width: 44px;
	}
}

/* ===== 分页 ===== */
.pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 16px;
	font-size: 13px;
}
.pagination .page-info {
	font-family: var(--mono);
	color: var(--fg-muted);
	min-width: 60px;
	text-align: center;
}
.pagination select {
	height: 32px;
	padding: 0 8px;
	font-size: 13px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--fg);
}

/* ===== Modal(二次确认) ===== */
.modal-backdrop {
	position: fixed;
	inset: 0;
	z-index: 200;
	background: rgba(17, 24, 39, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	animation: fadeIn 0.12s ease;
}
@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}
.modal {
	background: var(--surface);
	border-radius: var(--radius);
	padding: 24px;
	max-width: 420px;
	width: calc(100% - 32px);
	box-shadow: var(--shadow);
}
.modal h3 {
	margin: 0 0 16px;
	font-size: 16px;
	font-weight: 600;
}
.modal dl {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 6px 16px;
	margin: 0 0 16px;
	font-size: 13px;
}
.modal dt {
	color: var(--fg-muted);
}
.modal dd {
	margin: 0;
	font-family: var(--mono);
}
.modal .warn {
	color: var(--danger);
	font-size: 12px;
	margin: 0 0 16px;
}
.modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

/* ===== Toast ===== */
.toast {
	position: fixed;
	bottom: 16px;
	left: 50%;
	transform: translateX(-50%);
	padding: 10px 16px;
	background: var(--fg);
	color: var(--bg);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	z-index: 1000;
	font-size: 13px;
	opacity: 0;
	transition: opacity 0.2s;
}
.toast.visible {
	opacity: 0.95;
}

/* ===== 全局滚动 ===== */
html {
	scroll-behavior: smooth;
}
body {
	overflow-x: hidden;
}

/* ===== 卡片内部布局 ===== */
.card .row {
	display: flex;
	gap: 16px;
	align-items: center;
	flex-wrap: wrap; /* 移动端自动换行 */
}
.card .room-id {
	font-weight: 600;
	font-family: var(--mono);
	font-size: 14px;
}
.card .card-actions {
	margin-left: auto;
	display: flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
}
/* 历史卡片 actions 全断点 icon-only + 紧凑间距 (PC / 移动统一) */
.historical-card .card-actions {
	gap: 4px;
}
.historical-card .card-actions .btn.icon,
.historical-card .card-actions .room-link {
	width: 32px;
	height: 32px;
	padding: 0;
}
.card .ts {
	font-size: 11px;
	color: var(--fg-muted);
	font-family: var(--mono);
}

/* ===== 移动端卡片堆叠 ===== */
@media (max-width: 639px) {
	.card .row {
		gap: 8px;
	}
	.card .card-actions {
		margin-left: 0;
		width: 100%;
		justify-content: flex-end;
	}
	.card .meta {
		width: 100%;
	}
	.card .players {
		width: 100%;
	}
}

/* ===== 首页特� ===== */
/* ===== 首页看板(8 项指标) ===== */
.dashboard {
	margin-top: 8px;
}
.dashboard .section-title {
	margin: 8px 0 12px;
}
.dashboard-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 12px;
}
.dashboard-card {
	background: var(--bg-subtle);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 16px 18px;
	box-shadow: var(--shadow-sm);
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}
.dashboard-card--games {
	background: var(--primary-soft);
}
.dashboard-card--winrate {
	background: var(--surface);
}
.stat-value {
	font-family: var(--mono);
	font-size: 1.8rem;
	font-weight: 700;
	color: var(--primary);
	line-height: 1.2;
	letter-spacing: -0.01em;
	font-variant-numeric: tabular-nums;
}
.dashboard-card--winrate .stat-value {
	color: var(--fg);
}
.stat-label {
	font-size: 12px;
	font-weight: 500;
	color: var(--fg-muted);
	letter-spacing: 0.02em;
}
.dashboard-divider {
	border: 0;
	border-top: 1px solid var(--border);
	margin: 20px 0 0;
}
@media (max-width: 1023px) {
	.dashboard-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
@media (max-width: 479px) {
	.dashboard-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

.create-form {
	display: flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
}
.create-form input[type="text"] {
	flex: 1;
	min-width: 200px;
	padding: 8px 12px;
	font-size: 14px;
	font-family: var(--mono);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--fg);
}
.create-form input[type="text"]:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: var(--shadow-active);
}
.create-form button {
	flex-shrink: 0;
}
.create-msg {
	/* P2-2: 块级元素直接接 form 下方;margin 由组件自己负责垂直间距,
     不再依赖 :not(:empty) margin-left(原 form 内 flex item 撑出来的右侧偏移) */
	display: block;
	width: 100%;
	margin: 8px 0 0;
	font-size: 12px;
	line-height: 1.5;
	min-height: 1em;
}

/* ===== 多局回放 toolbar + grid ===== */
.multi-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	position: sticky;
	top: 56px;
	z-index: 9;
}
.multi-toolbar .label {
	font-size: 13px;
	color: var(--fg-muted);
}
.multi-toolbar input[type="number"] {
	width: 60px;
	height: 36px;
	padding: 0 8px;
	font-size: 13px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--fg);
}
.multi-toolbar .btn {
	white-space: nowrap;
}

/* multi-replay grid/cell 样式由 multi-replay.html 的 inline <style> 负责,
   这里只留 toolbar 和 button 样式。 */
@media (max-width: 639px) {
	.multi-toolbar {
		padding: 10px 12px;
		gap: 6px;
	}
	.multi-toolbar .btn {
		height: 40px;
		padding: 0 12px;
		font-size: 12px;
	}
}

/* ===== 筛选表单(历史录制) ===== */
.filter-form {
	display: block;
	padding: 14px;
	margin-bottom: 12px;
	background: var(--bg-subtle);
	border: 1px solid var(--border);
	border-radius: var(--radius);
}
.filter-common {
	display: grid;
	/* 高级筛选入口已上移至标题行,这里只放玩家名 / 房间 ID / 状态 / 应用&重置。 */
	grid-template-columns:
		minmax(180px, 1.1fr) minmax(180px, 1fr) minmax(160px, 0.8fr)
		auto;
	align-items: center;
	gap: 8px;
}
.filter-input {
	height: 36px;
	padding: 0 10px;
	font-size: 13px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--fg);
	min-width: 0;
	width: 100%;
	font-family: var(--mono);
}
.filter-input:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: var(--shadow-active);
}
.filter-sep {
	color: var(--fg-muted);
	font-family: var(--mono);
	font-size: 14px;
	user-select: none;
}
.filter-actions {
	display: flex;
	align-items: center;
	gap: 4px;
	white-space: nowrap;
}
.filter-actions .btn {
	height: 36px;
}
/* 桌面:筛选表单所有按钮(应用/重置/高级入口)与 input 等高,保持水平基线。 */
.filter-form .btn {
	height: 36px;
}
.filter-advanced {
	width: 100%;
}
.filter-advanced > summary {
	display: none;
}
.filter-advanced:not([open]) .filter-advanced-grid {
	display: none;
}
.filter-advanced-grid {
	/* 三组高级字段:时间、玩家 ID、回合数。每组内 fieldset 自带 grid,
     外层用三列等宽,避免之前 7 列网格在中等宽度错位。 */
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	align-items: center;
	gap: 8px;
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid var(--border);
}
/* 高级字段组:fieldset 零样式,内部 grid 让“label + 两个 input + 箭头”自然换行。 */
.filter-field-group {
	border: 0;
	padding: 0;
	margin: 0;
	min-width: 0;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	align-items: center;
	gap: 6px;
}
.filter-field-group[data-filter-group="player-id"] {
	grid-template-columns: minmax(0, 1fr);
}
.filter-field-group .filter-sep {
	color: var(--fg-muted);
	font-family: var(--mono);
}
@media (max-width: 1050px) {
	.filter-common {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
	.filter-actions {
		justify-self: end;
		grid-column: 3;
	}
	.filter-advanced-grid {
		grid-template-columns: 1fr;
	}
	.filter-advanced-grid .filter-sep {
		display: none;
	}
	.filter-field-group,
	.filter-field-group[data-filter-group="player-id"] {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* ===== 批量操作条 ===== */
.bulk-bar {
	display: none;
	align-items: center;
	gap: 12px;
	padding: 10px 16px;
	margin-bottom: 8px;
	background: var(--primary-soft);
	border: 1px solid var(--primary);
	border-radius: var(--radius);
	font-size: 13px;
	color: var(--fg);
}
.bulk-bar.visible {
	display: flex;
}
.bulk-bar .bulk-count-text {
	font-weight: 500;
}
.bulk-bar .bulk-count-text b {
	color: var(--primary);
	font-family: var(--mono);
}
.bulk-bar .bulk-select-all {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	user-select: none;
}
.bulk-bar .bulk-select-all input {
	width: 16px;
	height: 16px;
	cursor: pointer;
}
.bulk-bar > .btn {
	margin-left: auto;
}
.bulk-bar > .btn + .btn {
	margin-left: 0;
}
.bulk-bar > .btn:not(:first-child) {
	margin-left: 0;
}
@media (max-width: 639px) {
	.bulk-bar {
		flex-wrap: wrap;
		gap: 8px;
		padding: 10px 12px;
	}
	.bulk-bar > .btn {
		margin-left: 0;
	}
	.bulk-bar .bulk-count-text {
		width: 100%;
		order: 2;
	}
}

/* ===== 历史卡片 checkbox 列 ===== */
.historical-card .card-checkbox {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 2px;
	margin-right: 4px;
}
.historical-card .card-checkbox input {
	width: 16px;
	height: 16px;
	cursor: pointer;
	accent-color: var(--primary);
}

/* ===== 表单校验错误提示 ===== */
.create-msg[data-kind="error"] {
	color: var(--danger);
	font-weight: 500;
}
.create-msg[data-kind="success"] {
	color: var(--success);
	font-weight: 500;
}

/* B12: input 校验红框视觉 + aria-invalid 化
   用 [data-error] 属性而不是 :invalid,避免污染 RFC 验证流程(novalidate 仍开) */
.create-form input[type="text"][data-error] {
	border-color: var(--danger);
	outline: 2px solid var(--danger-soft);
	outline-offset: -1px;
}
.create-form input[type="text"][data-error]:focus {
	outline-color: var(--danger);
	border-color: var(--danger);
}

/* 视觉隐藏但保留可访问性(用于 label) */
.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* H5: 主题切换按钮 */
.theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--fg-muted);
	cursor: pointer;
	transition: all 0.12s ease;
}
.theme-toggle:hover {
	background: var(--bg-subtle);
	color: var(--fg);
}
.theme-toggle svg {
	width: 16px;
	height: 16px;
}

/* M10: 尊重 prefers-reduced-motion(用户偏好减少动画) */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* L1: btn-play 内 icon-play / icon-pause 切换显示
   data-running 在父元素 .replay-buttons 上 (不是 #btn-play 本身),
   之前用 #btn-play[data-running="1"] 的写法特异性 (1,1,1) 比
   #btn-play .icon-pause 的 (1,0,1) 高, 但 #btn-play 没有 data-running 属性,
   该规则实际从不命中 -> pause 永远 hidden. 改为 .replay-buttons[data-running] 后
   与 replay.html 内联 .replay-buttons[data-running="X"] 规则一�� (同特异性 + 后写者赢). */
.replay-buttons .icon-play,
.replay-buttons .icon-pause {
	display: inline-flex;
}
.replay-buttons[data-running="1"] .icon-play {
	display: none;
}
.replay-buttons[data-running="1"] .icon-pause {
	display: inline-flex;
}
.replay-buttons[data-running="0"] .icon-pause {
	display: none;
}

/* L1: replay-step / mini-controls button 图标尺寸 */
.replay-step svg,
.mini-controls button svg {
	width: 14px;
	height: 14px;
	vertical-align: middle;
}
.multi-toolbar .btn svg {
	width: 14px;
	height: 14px;
	vertical-align: middle;
}

/* L2: 全部倍速选择器 */
.speed-all-wrap {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: var(--fg-muted);
}
.speed-all-wrap select {
	height: 36px;
	padding: 0 8px;
	font-size: 13px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--fg);
}

/* L3: 多局 cell 移动端高度自适应 */
@media (max-width: 639px) {
	.multi-cell .frame {
		aspect-ratio: 4 / 3;
		min-height: 220px;
	}
}

/* L6: modal focus-visible 强化 */
.modal button:focus-visible {
	outline: 2px solid var(--primary);
	outline-offset: 2px;
}

/* v12-2026-07-21 (F10): share modal 内 admin 公开可见 checkbox 自定义样式,
   统一跨平台观感, 焦点环可见。 */
.modal input[type="checkbox"] {
	width: 16px;
	height: 16px;
	margin: 0;
	cursor: pointer;
	accent-color: var(--primary);
	flex-shrink: 0;
}
.modal input[type="checkbox"]:focus-visible {
	outline: 2px solid var(--primary);
	outline-offset: 2px;
}

/* L1: btn-play 内 svg 文字混排 */
#btn-play {
	gap: 6px;
}
#btn-play svg {
	width: 14px;
	height: 14px;
}

/* L5: lang=en 时把角落 "回放中 · 操作已禁用" 标签切到英文。
   :lang(en) 选择器特异性高于 .replay-iframe-wrap::after,因而覆盖默认 */
:lang(en) .replay-iframe-wrap::after {
	content: "Replaying · disabled";
}

/* ===== B4 配套:player 404/error UI ===== */
.player-not-found {
	padding: 60px 24px;
	text-align: center;
	color: var(--fg-muted);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	margin: 24px 0;
}
.player-not-found h2 {
	color: var(--fg);
	margin: 0 0 8px;
	font-size: 18px;
}
.player-not-found p {
	margin: 0 0 20px;
	font-size: 13px;
}
.player-not-found .btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 36px;
	min-width: 160px;
	padding: 0 16px;
	background: var(--primary);
	color: var(--primary-fg);
	border: 1px solid var(--primary);
	border-radius: var(--radius-sm);
	text-decoration: none;
	font-size: 14px;
}
.player-not-found .btn:hover {
	filter: brightness(0.95);
}

/* ============================================================
 * Replay DOM board (ccbs.css + ccbs-theme-overrides.css 配套)
 * 追加: ccbs 内部小部件定位 + replay-player-* 玩家面板 utility。
 * 这些是 ccbs.css 没定义、官方 React 端用 inline style 处理的部分。
 * ============================================================ */

/* 卡内右上角 bonus chip(官方 React 端用 absolute top-1 right-1) */
.ccbs-bonus-chip {
	position: absolute;
	top: 4px;
	right: 4px;
	width: 20px;
	height: 20px;
	line-height: 18px;
	font-size: 12px;
	border: 1px solid #fff;
	box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.2);
	border-radius: 4px;
}
:root[data-theme="dark"] .ccbs-bonus-chip {
	border-color: #ddd;
}

/* 卡左上角 score 数字(官方用 left-0.5,这里简化 left:0) */
.ccbs-score.left-0 {
	left: 0;
	text-align: left;
	padding-left: 4px;
	box-sizing: border-box;
}

/* 卡底部 cost chips(官方 React 端 absolute bottom-0.5 left-0.5 + flex-col-reverse) */
.ccbs-cost-chips {
	position: absolute;
	bottom: 4px;
	left: 4px;
	display: flex;
	flex-direction: column-reverse;
	gap: 2px;
}
.ccbs-cost-chip {
	position: relative;
	font-size: 13px;
	width: 26px;
	height: 26px;
	line-height: 26px;
	border-width: 1px;
	box-sizing: border-box;
}

/* 贵族左侧 req chip 容器(ccbs-noble-left 是 absolute 覆盖到左半) */
.ccbs-req-chip {
	margin: 2px 0;
	width: 18px;
	height: 22px;
	line-height: 20px;
	font-size: 11px;
	text-align: center;
	border: 1px solid #fff;
	border-radius: 4px;
	box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.2);
	color: #fff;
	font-weight: 700;
	text-shadow:
		0 0 0.1em #000,
		0 0 0.1em #000,
		0 0 0.1em #000;
}

/* ====== 玩家面板 ====== */
.replay-player-panel {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-left: 3px solid transparent;
	border-radius: var(--radius-sm);
	font-size: 13px;
	color: var(--fg);
	transition: border-color 120ms ease;
}
.replay-player-panel[data-active="true"] {
	border-left-color: var(--primary);
	background: var(--bg-subtle);
}
.replay-player-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	font-size: 22px;
	flex: 0 0 auto;
	background: var(--bg-subtle);
	border-radius: 50%;
}
.replay-player-info {
	display: flex;
	align-items: center;
	gap: 6px;
	min-width: 80px;
}
.replay-player-name {
	font-weight: 600;
	color: var(--fg);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 120px;
}
/* v5-2026-07-19: owner 走 absolute overlay (由 replay.html 的 .replay-player-avatar .replay-player-owner 接管);
   这里仅保留 font-weight 兜底, 避免一些老 caller 直接挂在 panel 上时塌掉 */
.replay-player-owner {
	font-weight: 600;
}
.replay-player-gems,
.replay-player-bonuses,
.replay-player-reserves,
.replay-player-decks {
	display: flex;
	gap: 3px;
	align-items: center;
	flex-wrap: wrap;
}
.replay-player-gems .ccbs-rect,
.replay-player-bonuses .ccbs-circle {
	font-size: 12px;
}
.replay-player-bonuses .ccbs-circle.ccbs-small {
	--ccbs-scale: 0.55;
	font-size: 11px;
}
.replay-player-reserves .ccbs-card,
.replay-player-decks .ccbs-card {
	width: 36px;
	height: 48px;
}
.replay-player-score {
	margin-left: auto;
	font-weight: 700;
	color: var(--fg);
	font-size: 14px;
	white-space: nowrap;
}

/* 移动端断点(≤480px):玩家面板拆双行 */
@media (max-width: 480px) {
	.replay-player-panel {
		flex-wrap: wrap;
		row-gap: 6px;
	}
	.replay-player-info {
		flex: 1 1 100%;
	}
	.replay-player-gems,
	.replay-player-bonuses,
	.replay-player-reserves,
	.replay-player-decks {
		flex: 1 1 auto;
	}
	.replay-player-score {
		margin-left: auto;
	}
}

/* Game list participants 网格(Task 5/6) */
/* auto-fit 紧凑网格,2-4 玩家对局自适应;winner 加左侧强调色 + 软底 */
.participants-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 8px;
	margin-top: 6px;
}
.participant {
	display: flex;
	align-items: baseline;
	gap: 4px;
	flex-wrap: wrap;
	font-size: 12px;
	padding: 4px 8px;
	background: var(--bg-subtle, #f5f5f5);
	border-radius: 4px;
	border-left: 3px solid transparent;
}
.participant.is-winner {
	border-left-color: var(--success, #16a34a);
	background: var(--success-soft, #f0fdf4);
}
.participant .name {
	font-weight: 500;
}
.participant .score {
	font-weight: 600;
}
.participant .meta {
	color: var(--fg-muted, #6b7280);
	font-size: 11px;
}
.participant .winner-mark {
	font-size: 11px;
}
.participants-empty {
	color: var(--fg-muted, #6b7280);
	font-size: 12px;
	margin-top: 4px;
	font-style: italic;
}

@media (max-width: 600px) {
	.participants-grid {
		grid-template-columns: repeat(2, 1fr);
	}
	.participant {
		font-size: 11px;
		padding: 3px 6px;
	}
}

/* ===== room-link: icon-only 外链按钮 (跳 hullqin 房间) ===== */
.room-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: var(--radius-sm);
	color: var(--fg-muted);
	border: 1px solid transparent;
	background: transparent;
	text-decoration: none;
	transition:
		background 0.15s,
		color 0.15s,
		border-color 0.15s;
}
.room-link:hover {
	background: var(--bg-subtle);
	color: var(--fg);
	border-color: var(--border);
}
.room-link:focus-visible {
	outline: none;
	box-shadow: var(--shadow-active);
}
@media (max-width: 639px) {
	.room-link {
		width: 36px;
		height: 36px;
	}
}

/* ===== replay-room-card: 房间号小卡片 (浮在 board-wrap 左上角) ===== */
.replay-room-card {
	position: absolute;
	top: 8px;
	left: 12px;
	z-index: 5;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	font-size: 13px;
	box-shadow: var(--shadow-sm);
	/* 防止小屏被棋盘遮住,棋盘场景默认 padding 8/12/12,左 12px 与卡片对齐 */
}
.replay-room-card .label {
	color: var(--fg-muted);
	font-weight: 500;
}
.replay-room-card .value {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	color: var(--fg);
	text-decoration: none;
	font-weight: 600;
}
.replay-room-card .value:hover {
	color: var(--primary);
}
.replay-room-card .value:focus-visible {
	outline: none;
	box-shadow: var(--shadow-active);
	border-radius: 2px;
}
.replay-room-card .icon {
	opacity: 0.7;
}
@media (max-width: 639px) {
	.replay-room-card {
		top: 4px;
		left: 8px;
		font-size: 12px;
		padding: 4px 8px;
	}
}

/* ===== Logo / brand ===== */
.app-logo {
	display: inline-block;
	vertical-align: middle;
}
.app-wordmark {
	vertical-align: middle;
}

/* 顶部 page-header 中的 wordmark(h1 #app-brand) */
.page-header .app-brand {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}
.page-header .app-brand .app-logo-wordmark {
	font-size: 16px;
	font-weight: 600;
}

/* replay summary 中的小 logo(与文字水平对齐) */
.replay-brand {
	display: inline-flex;
	align-items: center;
	margin-right: 4px;
}
.replay-brand .app-logo {
	display: block;
}

/* ============================================================
   Mobile optimization (≤639px) — 录制列表页 v2
   目标:提高密度、极简卡片、logo 放大、菜单折叠、筛选折叠
   ============================================================ */

/* 弹层菜单(全断点) */
.auth-menu {
	position: relative;
	display: inline-flex;
	align-items: center;
}
.auth-menu-popover {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	min-width: 180px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow);
	padding: 4px 0;
	z-index: 100;
}
.auth-menu-header {
	padding: 8px 12px;
	font-size: 12px;
	color: var(--fg-muted);
	border-bottom: 1px solid var(--border);
	margin-bottom: 4px;
	white-space: nowrap;
}
.auth-menu-item {
	display: block;
	width: 100%;
	padding: 8px 12px;
	background: transparent;
	border: none;
	color: var(--fg);
	text-align: left;
	font-size: 13px;
	cursor: pointer;
	text-decoration: none;
	font: inherit;
	white-space: nowrap;
}
.auth-menu-item:hover {
	background: var(--bg-subtle);
}

/* 高级筛选入口位于常用筛选栏，数量徽标提示折叠中的生效条件。 */
.filter-toggle {
	display: inline-flex;
	height: 36px;
	padding: 0 10px;
	font-size: 12px;
	font-weight: 500;
	background: var(--surface);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	color: var(--fg-muted);
	align-items: center;
	gap: 4px;
	cursor: pointer;
	transition: all 0.12s ease;
}
.filter-toggle:hover {
	border-color: var(--primary);
	color: var(--fg);
}
.filter-toggle.has-active-filters {
	border-color: var(--primary);
	color: var(--primary);
}
.filter-toggle svg {
	transition: transform 0.15s ease;
}
.filter-toggle.is-open svg {
	transform: rotate(180deg);
}
.filter-toggle-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 9px;
	background: var(--primary);
	color: var(--primary-fg, #fff);
	font: 600 11px/1 var(--mono);
}
.filter-toggle-count[hidden] {
	display: none;
}

@media (max-width: 639px) {
	/* 顶部 header 紧凑 */
	.page-header {
		padding: 6px 12px;
		min-height: 40px;
		gap: 6px;
	}
	.page-header .app-brand .app-logo-wordmark {
		display: none;
	}
	.page-header .app-brand .app-logo {
		transform: scale(2);
		transform-origin: left center;
		margin-right: 12px;
	}
	/* P2-8 (2026-08-31): 移动端把 theme/lang toggle 触控区扩到 40px (iOS HIG ≥44px,
	 * 桌面端保持 32px)。padding 扩热区不破坏 layout。 */
	.page-header .theme-toggle,
	.page-header #lang-toggle {
		min-width: 40px;
		min-height: 40px;
		padding: 0;
	}
	.page-header #lang-toggle {
		font-size: 10px;
	}
	/* P2-10 (2026-08-31): 移动端 auth-menu-trigger 与 nav-link 触控区扩到 ≥40px,
	 * 桌面端保持原样。padding 扩热区不破坏 layout。 */
	.auth-menu-trigger {
		min-width: 40px;
		min-height: 40px;
		padding: 0;
	}
	.page-header .header-nav-link {
		min-height: 40px;
		display: inline-flex;
		align-items: center;
	}

	/* section 间距收紧 */
	main {
		padding: 12px;
	}
	section {
		margin-bottom: 16px;
	}
	.section-title {
		margin: 16px 0 8px;
		padding-bottom: 4px;
	}
	/* card 内边距收紧 */
	.card {
		padding: 8px 10px;
		margin-bottom: 6px;
		border-radius: var(--radius-sm);
	}

	/* 极简历史卡片:checkbox + 房间 id + 按钮 一行 */
	.historical-card .row {
		flex-wrap: nowrap;
		gap: 6px;
		align-items: center;
	}
	.historical-card .room-id-block {
		display: flex;
		flex-direction: column;
		min-width: 0;
		flex: 1 1 auto;
		overflow: hidden;
	}
	.historical-card .room-id {
		font-size: 13px;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.historical-card .recorded-at {
		font-size: 10px;
		color: var(--fg-subtle);
		font-family: var(--mono);
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.historical-card .card-actions {
		margin-left: 0;
		width: auto;
		justify-content: flex-end;
		flex-shrink: 0;
	}

	/* participants 网格:固定 2 列 */
	.participants-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 4px;
	}
	.participant {
		font-size: 11px;
		padding: 3px 6px;
	}

	/* 筛选表单 */
	.filter-form {
		padding: 10px;
	}
	.filter-common {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 6px;
	}
	.filter-common .filter-input--primary {
		grid-column: 1 / -1;
	}
	.filter-common .filter-status-group {
		min-width: 0;
	}
	.filter-input {
		height: 40px;
		font-size: 14px;
	}
	.filter-toggle {
		width: 100%;
		height: 38px;
		grid-column: 1 / -1;
		justify-content: center;
	}
	.filter-actions {
		width: 100%;
		grid-column: 1 / -1;
		justify-self: stretch;
	}
	.filter-actions .btn {
		flex: 1 1 0;
		height: 38px;
	}
	.filter-advanced[open] .filter-advanced-grid {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 6px;
		margin-top: 10px;
		padding-top: 10px;
	}
	.filter-advanced:not([open]) .filter-advanced-grid {
		display: none;
	}
	.filter-advanced-grid .filter-sep {
		display: none;
	}
	.filter-advanced-grid .filter-input {
		width: 100%;
		min-width: 0;
		height: 38px;
		font-size: 13px;
	}
	.filter-form .btn {
		font-size: 13px;
	}

	/* 批量操作条 */
	.bulk-bar {
		padding: 8px 10px;
		gap: 6px;
		font-size: 12px;
		flex-wrap: wrap;
	}
	.bulk-bar .btn {
		height: 36px;
		padding: 0 10px;
		font-size: 12px;
	}
	.bulk-bar .bulk-count-text {
		width: 100%;
		order: 2;
	}

	/* 分页 */
	.pagination {
		padding: 12px;
		font-size: 12px;
		gap: 8px;
	}
	.pagination select {
		height: 36px;
	}

	/* 创建录制表单 */
	.create-form input[type="text"] {
		min-width: 0;
		height: 40px;
	}
	.create-form .btn {
		height: 40px;
	}
}

/* 语义修饰类（取代内联 style 残留，master plan §6.3） */
.filter-input--wide {
	min-width: 160px;
}
.filter-input--narrow {
	min-width: 140px;
}
.filter-input--fixed-140 {
	flex: 0 0 140px;
}
.filter-input--grow {
	flex: 1 1 220px;
}
.filter-actions-col {
	text-align: right;
}
.lang-btn--compact {
	margin-right: 6px;
	font-size: 11px;
	font-weight: 600;
}

/* status-multiselect: 按钮 + checkbox popover,沿用既有 filter-* 视觉语言。 */
.status-multiselect {
	position: relative;
	display: block;
	min-width: 0;
}
.status-trigger {
	appearance: none;
	background: var(--surface, #fff);
	border: 1px solid var(--border, #d4d4d8);
	border-radius: 6px;
	padding: 6px 10px;
	width: 100%;
	text-align: left;
	cursor: pointer;
	font-size: 13px;
	color: var(--fg, #1f2937);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
	height: 36px;
}
.status-trigger:hover {
	border-color: var(--accent, #2563eb);
}
.status-trigger::after {
	content: "▾";
	color: var(--fg-muted, #6b7280);
	font-size: 11px;
}
.status-trigger[aria-expanded="true"] {
	border-color: var(--accent, #2563eb);
	box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.status-popover {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	min-width: 100%;
	max-width: 240px;
	background: var(--surface, #fff);
	border: 1px solid var(--border, #d4d4d8);
	border-radius: 8px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
	padding: 8px;
	z-index: 100;
}
.status-options {
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.status-option {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 4px;
	cursor: pointer;
	font-size: 13px;
	border-radius: 4px;
}
.status-option:hover {
	background: var(--surface-hover, #f3f4f6);
}
.status-option input[type="checkbox"] {
	margin: 0;
}
.status-actions {
	display: flex;
	justify-content: flex-end;
	gap: 6px;
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid var(--border, #e5e7eb);
}
.status-actions .btn {
	font-size: 12px;
	padding: 4px 10px;
}

.active-card.is-readonly .card-actions {
	/* 匿名 active 卡片不显示内部操作,只留原房间链接 + 状态文本 */
	gap: 8px;
}
.active-card.is-readonly {
	opacity: 0.95;
}
