/* 宠物冒险：左上角「单元选择器」
   ------------------------------------------------------------------
   #adv-where 原本是一颗只读的 chip（「单元4 · 控制程序的“指挥棒”」）。
   这里把它包进一个按钮里（不动元素本身，adv.js 依旧用 getElementById
   改它的文字），点开后弹出一个单元列表，选哪个就点哪个。

   面板挂在 body 上（position:fixed），因为 .adv-mapbox 是
   overflow:hidden，放在里面会被裁掉。 */

#adv .adv-hud .aktw-uw-trigger {
	pointer-events: auto;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	max-width: 100%;
	margin: 0;
	padding: 4px 9px 4px 11px;
	border: 1px solid rgba(255, 255, 255, .26);
	border-radius: 999px;
	background: rgba(12, 40, 26, .72);
	color: #fff;
	font: inherit;
	font-size: 11.5px;
	line-height: 1.6;
	letter-spacing: normal;
	text-align: left;
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

/* 内层还是原来那颗 chip，背景/内边距交给外层按钮统一画 */
#adv .adv-hud .aktw-uw-trigger .adv-hud-chip {
	padding: 0;
	background: none;
	backdrop-filter: none;
	-webkit-backdrop-filter: none;
	color: #fff;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

#adv .adv-hud .aktw-uw-trigger:hover {
	background: rgba(12, 40, 26, .88);
	border-color: rgba(255, 255, 255, .45);
}

#adv .adv-hud .aktw-uw-trigger.is-open {
	background: rgba(12, 40, 26, .94);
	border-color: rgba(255, 255, 255, .55);
	box-shadow: 0 0 0 3px rgba(255, 255, 255, .16);
}

#adv .adv-hud .aktw-uw-trigger:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.aktw-uw-caret {
	flex: none;
	font-size: 9px;
	line-height: 1;
	opacity: .82;
	transform: translateY(-1px);
	transition: transform .18s ease;
}

.aktw-uw-trigger.is-open .aktw-uw-caret {
	transform: translateY(1px) rotate(180deg);
}

/* ---------------- 弹出面板 ---------------- */

.aktw-uw {
	position: fixed;
	z-index: 100000;
	left: 0;
	top: 0;
	width: 300px;
	max-width: calc(100vw - 16px);
	padding: 8px;
	border-radius: 16px;
	border: 1px solid #dcebe2;
	background: #fff;
	color: #163b2a;
	font-family: inherit;
	font-size: 13px;
	line-height: 1.5;
	box-shadow:
		0 18px 40px rgba(16, 56, 34, .22),
		0 2px 8px rgba(16, 56, 34, .08);
	animation: aktw-uw-in .16s ease-out;
}

.aktw-uw[hidden] {
	display: none !important;
}

@keyframes aktw-uw-in {
	from { opacity: 0; transform: translateY(-5px); }
	to   { opacity: 1; transform: none; }
}

.aktw-uw-hd {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 3px 6px 7px 8px;
	color: #5d8171;
	font-size: 11.5px;
	font-weight: 700;
	letter-spacing: .4px;
}

.aktw-uw-x {
	width: 22px;
	height: 22px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #f1f7f3;
	color: #6d8b7b;
	font-size: 11px;
	line-height: 1;
	cursor: pointer;
	transition: background .15s ease, color .15s ease;
}

.aktw-uw-x:hover {
	background: #e5f1e9;
	color: #2b6b48;
}

.aktw-uw-list {
	max-height: min(56vh, 372px);
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

.aktw-uw-item {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	margin: 0;
	padding: 7px 9px;
	border: 0;
	border-radius: 11px;
	background: none;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
	transition: background .13s ease;
}

.aktw-uw-item + .aktw-uw-item {
	margin-top: 2px;
}

.aktw-uw-item:hover {
	background: #f3f9f5;
}

.aktw-uw-item.is-on {
	background: #eaf6ee;
	box-shadow: inset 0 0 0 1px #b9ddc6;
}

.aktw-uw-item:focus-visible {
	outline: 2px solid #2b6b48;
	outline-offset: 1px;
}

.aktw-uw-no {
	flex: none;
	display: grid;
	place-items: center;
	width: 25px;
	height: 25px;
	border-radius: 9px;
	background: #eef4ef;
	color: #2b6b48;
	font-size: 12px;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .05);
}

.aktw-uw-item.is-on .aktw-uw-no {
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14);
}

.aktw-uw-t {
	flex: 1 1 auto;
	min-width: 0;
}

.aktw-uw-t b {
	display: block;
	font-size: 12.5px;
	font-weight: 700;
	color: #16352a;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.aktw-uw-item.is-on .aktw-uw-t b {
	color: #1d5c3c;
}

.aktw-uw-t small {
	display: block;
	margin-top: 1px;
	font-size: 10.5px;
	color: #7d9a8c;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.aktw-uw-cur {
	flex: none;
	width: 14px;
	color: #2b6b48;
	font-size: 12px;
	font-weight: 800;
	opacity: 0;
}

.aktw-uw-item.is-on .aktw-uw-cur {
	opacity: 1;
}

/* 小屏：面板贴边、字号略放大一点更好点 */
@media (max-width: 560px) {
	.aktw-uw {
		width: calc(100vw - 16px);
		max-width: 340px;
		padding: 7px;
	}

	.aktw-uw-item {
		padding: 9px 8px;
	}

	/* 一屏放得下 7 个单元，别让人还要在弹层里滚 */
	.aktw-uw-list {
		max-height: min(62vh, 420px);
	}

	#adv .adv-hud .aktw-uw-trigger {
		font-size: 11px;
		padding: 3px 8px 3px 10px;
	}
}
