/* SPDX-License-Identifier: AGPL-3.0-only */

:root {
	color-scheme: dark; /* 让原生控件（select 弹层、滚动条、日期选择）也按深色画 */

	--bg: #080b11;
	--bg-2: #0e141d;
	--card: #141c28;
	--card-hi: #1a2434;
	--line: rgba(255, 255, 255, 0.08);
	--line-hi: rgba(255, 255, 255, 0.16);
	--text: #e9eff9;
	--muted: #8b9ab2;
	--accent: #2e8bff;
	--accent-dim: #1b5fb0;
	--ok: #34d399;
	--warn: #fbbf24;
	--danger: #ff5a5f;
	--radius: 14px;
	--shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

* {
	box-sizing: border-box;
	-webkit-tap-highlight-color: transparent;
}

html,
html {
	touch-action: manipulation;
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	height: 100%;
	background: var(--bg);
	color: var(--text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
		"Microsoft YaHei", Roboto, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	overscroll-behavior: none;
	/* iOS Safari 会忽略 user-scalable=no，双击照样放大页面。
	   manipulation 关掉双击缩放，同时保留正常滚动/单指手势。 */
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}

body {
	background:
		radial-gradient(1200px 600px at 15% -10%, rgba(46, 139, 255, 0.16), transparent 60%),
		radial-gradient(900px 500px at 100% 0%, rgba(46, 139, 255, 0.08), transparent 55%), var(--bg);
}

.hidden {
	display: none !important;
}

.view {
	min-height: 100%;
	display: flex;
	flex-direction: column;
}

h1,
h2,
h3 {
	margin: 0;
	font-weight: 600;
}

h2 {
	font-size: 16px;
	letter-spacing: 0.02em;
}

h3 {
	font-size: 15px;
}

p {
	margin: 0;
}

.muted {
	color: var(--muted);
}

.small {
	font-size: 13px;
}

.mono {
	font-variant-numeric: tabular-nums;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 13px;
}

.row {
	display: flex;
	align-items: center;
}

.gap {
	gap: 10px;
}

.center {
	justify-content: center;
}

.brand {
	font-weight: 700;
	letter-spacing: 0.14em;
	font-size: 13px;
	color: var(--muted);
	text-transform: uppercase;
	white-space: nowrap;
}

.brand span {
	color: var(--text);
}

.brand.big {
	font-size: 20px;
	letter-spacing: 0.18em;
	color: var(--text);
}

.brand.big span {
	color: var(--accent);
}

/* ---------------------------- 通用控件 ---------------------------- */

button {
	font: inherit;
	cursor: pointer;
	border: 1px solid var(--line);
	background: var(--card);
	color: var(--text);
	border-radius: 10px;
	padding: 9px 14px;
	transition: background 0.15s, border-color 0.15s, transform 0.06s;
	white-space: nowrap;
}

button:hover {
	background: var(--card-hi);
	border-color: var(--line-hi);
}

button:active {
	transform: scale(0.98);
}

button:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

button.primary {
	background: linear-gradient(180deg, #3a93ff, #1f6fdb);
	border-color: transparent;
	color: #fff;
	font-weight: 600;
	box-shadow: 0 8px 22px rgba(46, 139, 255, 0.28);
}

button.primary:hover {
	background: linear-gradient(180deg, #4b9dff, #2a79e4);
}

button.ghost {
	background: rgba(255, 255, 255, 0.03);
}

button.danger,
button.ghost.danger {
	color: var(--danger);
	border-color: rgba(255, 90, 95, 0.35);
}

button.ghost.small {
	padding: 6px 10px;
	font-size: 13px;
}

input {
	font: inherit;
	/* iOS 上输入框字号小于 16px 时，聚焦会自动把页面放大 */
	font-size: 16px;
	color: var(--text);
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 10px 12px;
	outline: none;
	width: 100%;
	transition: border-color 0.15s, background 0.15s;
}

input:focus {
	border-color: rgba(46, 139, 255, 0.6);
	background: rgba(46, 139, 255, 0.06);
}

select {
	font: inherit;
	color: var(--text);
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 9px 10px;
	outline: none;
	width: 100%;
}

/* 万一还有原生下拉，选项也按深色来 */
option {
	background-color: var(--card);
	color: var(--text);
}

/* ---------------------------- 画质选项 ---------------------------- */

.quality {
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin-top: 4px;
}

.quality-row {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.quality-row > span {
	font-size: 13px;
	color: var(--muted);
}

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

.chips-grid {
	display: grid;
	gap: 8px;
}

.chip {
	flex: 1 1 auto;
	min-width: 76px;
	padding: 9px 12px;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid var(--line);
	color: var(--muted);
	font-size: 13.5px;
	text-align: center;
}

.chip:hover {
	background: rgba(255, 255, 255, 0.08);
	border-color: var(--line-hi);
	color: var(--text);
}

.chip.active {
	background: rgba(46, 139, 255, 0.18);
	border-color: rgba(46, 139, 255, 0.75);
	color: #ffffff;
	box-shadow: inset 0 0 0 1px rgba(46, 139, 255, 0.25);
}

.field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 14px;
}

.field > span {
	font-size: 13px;
	color: var(--muted);
}

.card {
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)), var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}

.error {
	color: var(--danger);
	font-size: 13px;
	min-height: 18px;
	margin-top: 8px;
}

.pill {
	font-size: 12px;
	padding: 4px 10px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--line);
	color: var(--muted);
}

.pill.on {
	color: var(--ok);
	border-color: rgba(52, 211, 153, 0.35);
}

.pill.busy {
	color: var(--warn);
	border-color: rgba(251, 191, 36, 0.35);
}

/* ---------------------------- 登录 ---------------------------- */

#view-login {
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.login-card {
	width: min(420px, 100%);
	padding: 30px 28px 24px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.login-card .brand {
	margin-bottom: 6px;
}

.login-card button {
	margin-top: 6px;
	padding: 11px 14px;
}

/* ---------------------------- 顶部栏 ---------------------------- */

.topbar {
	position: sticky;
	top: 0;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 22px;
	background: rgba(8, 11, 17, 0.72);
	backdrop-filter: blur(14px);
	border-bottom: 1px solid var(--line);
}

.content {
	width: min(1040px, 100%);
	margin: 0 auto;
	padding: 26px 22px 60px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.section-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 6px;
}

.section-head h2 {
	color: var(--muted);
	font-size: 13px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

/* ---------------------------- 主机卡片 ---------------------------- */

.host-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 14px;
}

.host-card {
	position: relative;
	padding: 16px 16px 14px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	transition: border-color 0.15s, transform 0.12s;
}

.host-card:hover {
	border-color: var(--line-hi);
}

.host-card .hc-top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 10px;
}

.host-card .hc-name {
	font-weight: 600;
	font-size: 16px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.host-card .hc-addr {
	font-size: 12px;
	color: var(--muted);
}

.host-card .hc-state {
	font-size: 11px;
	padding: 3px 8px;
	border-radius: 999px;
	border: 1px solid var(--line);
	color: var(--muted);
	white-space: nowrap;
}

.host-card .hc-state.paired {
	color: var(--ok);
	border-color: rgba(52, 211, 153, 0.35);
}

.host-card .hc-state.unpaired {
	color: var(--warn);
	border-color: rgba(251, 191, 36, 0.35);
}

.host-card .hc-actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.host-card .hc-actions button {
	flex: 1 1 auto;
	padding: 8px 10px;
	font-size: 13px;
}

.empty-hint {
	padding: 20px;
	border: 1px dashed var(--line);
	border-radius: var(--radius);
	text-align: center;
}

.add-form {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.add-form input {
	flex: 1 1 200px;
	width: auto;
}

.tips {
	padding: 16px 18px;
	margin-top: 8px;
}

.tips ul {
	margin: 10px 0 0;
	padding-left: 20px;
	color: var(--muted);
	font-size: 13.5px;
}

.tips li + li {
	margin-top: 6px;
}

/* ---------------------------- 播放器 ---------------------------- */

#view-player {
	position: fixed;
	inset: 0;
	background: #000;
}

.stage {
	position: relative;
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	touch-action: none;
	background: #000;
}

/* 竖屏 / 折叠屏：画面留在上半屏，下边缘正好卡在屏幕中线
   画面本身仍然居中于 .stage，所以 stage 高度取「屏高 - 画面高度」——
   这样画面垂直居中的结果就是底边落在 50% 处，下半屏整块留给按键 */
@media (orientation: portrait) {
	.stage {
		flex: none;
		height: max(30%, calc(100% - 100vw / var(--video-aspect, 1.7778)));
	}
}

#screen {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	background: #000;
}

.hud {
	position: absolute;
	inset: 0 0 auto 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 16px;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent);
	opacity: 1;
	transition: opacity 0.25s;
	pointer-events: none;
}

.hud > * {
	pointer-events: auto;
}

.hud.dim {
	opacity: 0;
}

.hud-left,
.hud-right {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: #d7e2f2;
	min-width: 0;
}

.hud-left {
	flex: 0 1 auto;
}

.hud-left #hud-title {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.hud-right {
	flex: 0 1 auto;
	justify-content: flex-end;
}

/* 指标文字可以被压缩省略，绝不允许压在右边的按钮上 */
.hud-right .mono {
	flex: 0 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* 沉浸模式：iOS 没有网页全屏 API，用固定定位把可视区吃满 */
body.immersive {
	overflow: hidden;
	overscroll-behavior: none;
}

body.immersive #view-player {
	position: fixed;
	inset: 0;
	z-index: 400;
	height: 100vh;
	height: 100dvh;
	background: #000;
}

body.immersive .stage {
	height: 100vh;
	height: 100dvh;
}

body.immersive .insecure-banner {
	display: none;
}

.rec-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--danger);
	box-shadow: 0 0 12px rgba(255, 90, 95, 0.8);
}

.rec-dot.idle {
	background: var(--muted);
	box-shadow: none;
}

.icon-btn {
	width: 38px;
	height: 38px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	background: rgba(12, 18, 27, 0.6);
	backdrop-filter: blur(8px);
	border-radius: 10px;
}

.icon-btn.danger {
	color: var(--danger);
}

/* 覆盖层 */

.overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(3, 6, 10, 0.78);
	backdrop-filter: blur(6px);
	z-index: 20;
	padding: 20px;
}

.overlay-card {
	width: min(400px, 100%);
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: 26px 22px;
	border-radius: var(--radius);
	background: var(--card);
	border: 1px solid var(--line);
	box-shadow: var(--shadow);
}

.spinner {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 3px solid rgba(255, 255, 255, 0.12);
	border-top-color: var(--accent);
	animation: spin 0.9s linear infinite;
}

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

.audio-unlock {
	position: absolute;
	left: 50%;
	bottom: 28px;
	transform: translateX(-50%);
	z-index: 15;
	padding: 10px 18px;
	background: rgba(46, 139, 255, 0.9);
	border-color: transparent;
	color: #fff;
	font-weight: 600;
	box-shadow: 0 10px 24px rgba(46, 139, 255, 0.35);
}

/* ---------------------------- 屏幕按键 ---------------------------- */

.touch-ui {
	--ctl: var(--ctl-scale, 1); /* 按键整体缩放，由「按键布局」调节 */
	--inset-scale: 1; /* 离屏幕边缘的距离系数（横向按倍数，纵向只跟一部分） */
	--inset-x: calc(clamp(22px, 5vw, 120px) * var(--inset-scale));
	--inset-y: calc(clamp(14px, 3vh, 34px) * (1 + (var(--inset-scale) - 1) * 0.3));
	--stick: calc(clamp(86px, 25vh, 118px) * var(--ctl));
	--face-btn: calc(clamp(38px, 10.5vh, 54px) * var(--ctl));
	--btn-gap: clamp(4px, 1vh, 8px);
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 10;
	font-size: 13px;
	user-select: none;
	-webkit-user-select: none;
	-webkit-touch-callout: none;
}

/* 触摸板生效区：只有屏幕正中间这一块算触摸板，边缘留给按键和手势 */
.pad-zone {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: 32%;
	height: 44%;
	border: 1px dashed rgba(255, 255, 255, 0.22);
	border-radius: 20px;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.16s;
	z-index: 8;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding-top: 10px;
	font-size: 11px;
	letter-spacing: 0.08em;
	color: rgba(255, 255, 255, 0.45);
}

.pad-zone.on {
	opacity: 1;
}

/* iOS 没有 Vibration API，用边缘柔光代替手柄震动 */
.rumble-glow {
	position: absolute;
	inset: 0;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.12s ease-out;
	box-shadow: inset 0 0 70px 10px rgba(120, 170, 255, 0.5);
	z-index: 9;
}

.tb {
	position: absolute;
	pointer-events: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 999px;
	background: rgba(20, 28, 40, 0.42);
	border: 1px solid rgba(255, 255, 255, 0.22);
	color: rgba(255, 255, 255, 0.9);
	backdrop-filter: blur(3px);
	touch-action: none;
	transition: background 0.08s, transform 0.08s;
}

.tb.active {
	background: rgba(46, 139, 255, 0.55);
	border-color: rgba(46, 139, 255, 0.9);
	transform: scale(0.94);
}

.tb-face {
	width: 58px;
	height: 58px;
	font-size: 19px;
	font-weight: 600;
}

/* 面板键与十字键：3×3 九宫格，中间留空，正好摆成手柄的十字 */
.pad-face,
.pad-dpad {
	--face: var(--face-btn);
	--pad-w: calc(var(--face) * 3 + var(--btn-gap) * 2);
	position: absolute;
	bottom: calc(var(--inset-y) + var(--stick) + 10px);
	display: grid;
	grid-template-columns: repeat(3, var(--face));
	grid-template-rows: repeat(3, var(--face));
	gap: var(--btn-gap);
	pointer-events: none;
}

/* 让十字键/面板键的中轴和摇杆中心对齐 */
.pad-face {
	right: calc(var(--inset-x) + (var(--stick) - var(--pad-w)) / 2);
}

.pad-dpad {
	left: calc(var(--inset-x) + (var(--stick) - var(--pad-w)) / 2);
}

.touch-ui.hide-dpad .pad-dpad {
	display: none;
}

.pad-face .tb,
.pad-dpad .tb {
	position: relative;
	left: auto;
	top: auto;
	right: auto;
	bottom: auto;
	width: 100%;
	height: 100%;
	font-size: calc(var(--face) * 0.42);
	background: rgba(16, 22, 32, 0.5);
}

.pad-dpad .tb {
	font-size: calc(var(--face) * 0.34);
}

.pad-dpad .tb.active {
	background: rgba(46, 139, 255, 0.5);
	border-color: rgba(255, 255, 255, 0.85);
}

.pad-face .f-t {
	grid-area: 1 / 2;
}
.pad-face .f-r {
	grid-area: 2 / 3;
}
.pad-face .f-b {
	grid-area: 3 / 2;
}
.pad-face .f-l {
	grid-area: 2 / 1;
}

.pad-dpad .d-u {
	grid-area: 1 / 2;
}
.pad-dpad .d-r {
	grid-area: 2 / 3;
}
.pad-dpad .d-d {
	grid-area: 3 / 2;
}
.pad-dpad .d-l {
	grid-area: 2 / 1;
}

/* 按手柄配色标一下，扫一眼就知道方位 */
.pad-face .f-tri {
	color: #4cd7a5;
	border-color: rgba(76, 215, 165, 0.5);
}
.pad-face .f-cir {
	color: #ff6b70;
	border-color: rgba(255, 107, 112, 0.5);
}
.pad-face .f-cro {
	color: #5aa8ff;
	border-color: rgba(90, 168, 255, 0.5);
}
.pad-face .f-squ {
	color: #ef7fc0;
	border-color: rgba(239, 127, 192, 0.5);
}

.pad-face .tb.active {
	background: rgba(46, 139, 255, 0.5);
	border-color: rgba(255, 255, 255, 0.85);
	color: #fff;
}

.tb-shoulder {
	width: 74px;
	height: 40px;
	border-radius: 12px;
	font-size: 12px;
	letter-spacing: 0.06em;
}

.tb-small {
	width: auto;
	min-width: 46px;
	height: 30px;
	padding: 0 10px;
	border-radius: 9px;
	font-size: 11px;
}

.tb-inline {
	position: relative;
	left: auto;
	top: auto;
	right: auto;
	bottom: auto;
}

/* 摇杆只是「视觉」，真正的手势由 canvas 统一处理，
   这样手指可以在整块下半屏按下去，摇杆跟过去 */
.tb-stick {
	width: var(--stick);
	height: var(--stick);
	border-radius: 50%;
	background: rgba(20, 28, 40, 0.32);
	border: 1px solid rgba(255, 255, 255, 0.18);
	pointer-events: none;
	transition: background 0.08s, opacity 0.12s;
}

.tb-stick.active {
	background: rgba(46, 139, 255, 0.2);
	border-color: rgba(90, 168, 255, 0.55);
}

.tb-knob {
	position: absolute;
	width: calc(var(--stick) * 0.44);
	height: calc(var(--stick) * 0.44);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.22);
	border: 1px solid rgba(255, 255, 255, 0.4);
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	pointer-events: none;
}

/* ---------------------------- 弹窗 ---------------------------- */

.modal-backdrop {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(2, 5, 9, 0.72);
	backdrop-filter: blur(6px);
}

.modal {
	width: min(460px, 100%);
	max-height: 86vh;
	overflow: auto;
	padding: 22px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.modal h3 {
	font-size: 17px;
}

.modal .modal-body {
	display: flex;
	flex-direction: column;
	gap: 12px;
	color: var(--muted);
	font-size: 14px;
}

.modal .modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
}

.modal .modal-actions button {
	min-width: 84px;
}

.log-list {
	display: flex;
	flex-direction: column;
	gap: 2px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12px;
	max-height: 340px;
	overflow: auto;
	background: rgba(0, 0, 0, 0.3);
	border-radius: 10px;
	padding: 10px;
}

.log-list .log-line {
	white-space: pre-wrap;
	word-break: break-word;
	color: var(--muted);
}

.log-list .log-line.warn {
	color: var(--warn);
}

.log-list .log-line.error {
	color: var(--danger);
}

.kbd-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.kbd-table td {
	padding: 5px 6px;
	border-bottom: 1px solid var(--line);
	color: var(--muted);
}

.kbd-table td:first-child {
	width: 110px;
}

kbd {
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid var(--line-hi);
	border-bottom-width: 2px;
	border-radius: 6px;
	padding: 1px 6px;
	font-family: inherit;
	font-size: 12px;
	color: var(--text);
}

/* ---------------------------- Toast ---------------------------- */

.toast-root {
	position: fixed;
	left: 50%;
	bottom: 22px;
	transform: translateX(-50%);
	z-index: 200;
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-items: center;
	pointer-events: none;
}

.toast {
	padding: 10px 16px;
	border-radius: 10px;
	background: rgba(20, 28, 40, 0.95);
	border: 1px solid var(--line-hi);
	box-shadow: var(--shadow);
	font-size: 13.5px;
	max-width: min(520px, 90vw);
	animation: toast-in 0.18s ease-out;
}

.toast.error {
	border-color: rgba(255, 90, 95, 0.5);
	color: #ffd7d8;
}

.toast.ok {
	border-color: rgba(52, 211, 153, 0.45);
}

@keyframes toast-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
}

/* ---------------------------- http 提示横幅 ---------------------------- */

.insecure-banner {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 300;
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px 16px;
	background: linear-gradient(180deg, rgba(120, 66, 0, 0.96), rgba(90, 48, 0, 0.94));
	border-bottom: 1px solid rgba(251, 191, 36, 0.45);
	color: #ffe9c7;
	font-size: 13px;
	line-height: 1.45;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.insecure-banner .ib-text {
	flex: 1;
	min-width: 0;
}

.insecure-banner strong {
	color: #ffd08a;
	font-weight: 600;
}

.insecure-banner button {
	flex: none;
	color: #ffe9c7;
	border-color: rgba(255, 233, 199, 0.4);
	background: rgba(255, 255, 255, 0.08);
}

/* ---------------------------- 接管提示 ---------------------------- */

.resume-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 18px;
	padding: 14px 16px;
	border-radius: 14px;
	border: 1px solid rgba(46, 139, 255, 0.45);
	background: rgba(46, 139, 255, 0.12);
}

.resume-text {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
	flex: 1 1 220px;
}

.resume-text strong {
	color: #cfe3ff;
	font-size: 14px;
}

/* ---------------------------- 窄屏 ---------------------------- */

@media (max-width: 900px) {
	.hud {
		padding: 8px 10px;
		gap: 8px;
	}

	.hud-left,
	.hud-right {
		font-size: 11px;
		gap: 6px;
	}

	.icon-btn {
		width: 32px;
		height: 32px;
		font-size: 14px;
		border-radius: 8px;
	}
}

/* 手机没有物理键盘，键盘映射说明用不上 */
@media (pointer: coarse) {
	#btn-keys {
		display: none;
	}
}

/* 横屏手机高度很紧：整体缩小，别撞到肩键 */
@media (max-height: 420px) {
	.touch-ui {
		--ctl: calc(0.92 * var(--ctl-scale, 1));
	}

	.tb-shoulder {
		height: 34px;
	}
}

@media (max-width: 640px) {
	.content {
		padding: 18px 14px 48px;
	}

	.topbar {
		padding: 12px 14px;
	}

	.brand {
		font-size: 11px;
	}

	.host-grid {
		grid-template-columns: 1fr;
	}

	.hud-right .mono {
		display: none;
	}

	.icon-btn {
		width: 34px;
		height: 34px;
	}
}

/* ---------------------------- 缩放还原 ---------------------------- */

.zoom-reset {
	position: fixed;
	left: 50%;
	top: calc(8px + env(safe-area-inset-top, 0px));
	transform: translateX(-50%);
	z-index: 9000;
	padding: 9px 16px;
	border-radius: 999px;
	border: 1px solid rgba(255, 196, 120, 0.55);
	background: rgba(64, 42, 12, 0.92);
	color: #ffd9a1;
	font-size: 13px;
	font-weight: 600;
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
	backdrop-filter: blur(6px);
}
