/* =========================================================
   AK Campus 老师 NPC —— 地图角色 + 对话面板
   命名统一加 aknpc- 前缀，避免和 ak-campus 原样式打架
   ========================================================= */

/* ---------------- 地图上的老师角色 ----------------
   注意：adv.css 是页面内容里后加载的，所以这里全部用
   .adv-actor.aknpc-act 提高权重，保证顺序怎么变都压得住。 */

.adv-actor.aknpc-act {
	pointer-events: auto !important;
	cursor: pointer;
	z-index: 7;
}

.adv-actor.aknpc-act .adv-body {
	position: relative;
	z-index: 1;
	width: 100%;
	height: 100%;
	transform-origin: 50% 100%;
	transform: scale(1.16);
	transition: transform .16s ease;
}

.adv-actor.aknpc-act:hover .adv-body {
	transform: scale(1.3) translateY(-2px);
}

.adv-actor.aknpc-act .aknpc-svg {
	width: 100%;
	height: 100%;
	display: block;
	/* 白色描边 + 投影：站在草地/水面/路上都能看清 */
	filter: drop-shadow(0 0 1.2px rgba(255, 255, 255, .95)) drop-shadow(0 0 1.6px rgba(255, 255, 255, .8)) drop-shadow(0 3px 4px rgba(15, 23, 42, .3));
}

/* 名字牌（复用 adv-name 的定位，换配色） */
.adv-actor.aknpc-act .adv-name {
	font-weight: 700;
	letter-spacing: .2px;
	background: rgba(15, 23, 42, .82);
	box-shadow: 0 1px 3px rgba(15, 23, 42, .25);
}

.adv-actor.aknpc-act[data-t="cui"] .adv-name { background: linear-gradient(180deg, #128a7b, #0f766e); }
.adv-actor.aknpc-act[data-t="chen"] .adv-name { background: linear-gradient(180deg, #2563eb, #1d4ed8); }
.adv-actor.aknpc-act[data-t="yang"] .adv-name { background: linear-gradient(180deg, #8b5cf6, #6d28d9); }

/* 站在旁边时脚下发光，提示可以聊 */
.adv-actor.aknpc-act.is-near::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: -2px;
	width: 88%;
	height: 8px;
	transform: translateX(-50%);
	border-radius: 50%;
	background: radial-gradient(closest-side, rgba(250, 204, 21, .85), rgba(250, 204, 21, 0) 78%);
	animation: aknpcPulse 1.5s ease-in-out infinite;
	pointer-events: none;
}

@keyframes aknpcPulse {
	0%, 100% { opacity: .45; transform: translateX(-50%) scale(.9); }
	50% { opacity: 1; transform: translateX(-50%) scale(1.08); }
}

/* 头顶随机冒出来的小气泡 */
.aknpc-bub {
	position: absolute;
	left: 50%;
	bottom: calc(100% + 15px);
	transform: translateX(-50%) translateY(4px);
	max-width: 132px;
	padding: 4px 8px;
	border-radius: 10px;
	background: #fff;
	border: 1.5px solid #d8e2dc;
	box-shadow: 0 6px 14px rgba(15, 23, 42, .14);
	color: #1f2937;
	font-size: 10.5px;
	line-height: 1.45;
	text-align: center;
	opacity: 0;
	transition: opacity .28s ease, transform .28s ease;
	pointer-events: none;
	white-space: nowrap;
	z-index: 8;
}

.aknpc-bub::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: -6px;
	width: 9px;
	height: 9px;
	transform: translateX(-50%) rotate(45deg);
	background: #fff;
	border-right: 1.5px solid #d8e2dc;
	border-bottom: 1.5px solid #d8e2dc;
}

.aknpc-bub.is-on {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* 轻提示（走太远点老师时用） */
.aknpc-toast {
	position: absolute;
	left: 50%;
	bottom: 46px;
	transform: translateX(-50%);
	z-index: 9;
	padding: 7px 14px;
	border-radius: 999px;
	background: rgba(15, 23, 42, .84);
	color: #fff;
	font-size: 12.5px;
	line-height: 1.4;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	transition: opacity .2s ease, transform .2s ease;
}

.aknpc-toast.is-on {
	opacity: 1;
	transform: translateX(-50%) translateY(-4px);
}

/* ---------------- 对话面板 ---------------- */

.aknpc-dlg {
	position: fixed;
	inset: 0;
	z-index: 2147483100;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	padding: 16px 16px 22px;
}

.aknpc-mask {
	position: absolute;
	inset: 0;
	background: rgba(12, 28, 20, .38);
	backdrop-filter: blur(2px);
	animation: aknpcFade .18s ease-out;
}

.aknpc-box {
	position: relative;
	width: 100%;
	max-width: 620px;
	max-height: min(78vh, 620px);
	display: flex;
	flex-direction: column;
	border-radius: 20px;
	background: #fff;
	border: 1.5px solid #e4ebe7;
	box-shadow: 0 26px 60px rgba(15, 23, 42, .24), 0 2px 0 rgba(255, 255, 255, .8) inset;
	overflow: hidden;
	animation: aknpcUp .26s cubic-bezier(.22, .9, .28, 1);
	font-size: 14px;
	color: #1f2937;
}

@keyframes aknpcFade { from { opacity: 0; } to { opacity: 1; } }

@keyframes aknpcUp {
	from { opacity: 0; transform: translateY(18px) scale(.985); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 顶部：老师头像 + 名字 */
.aknpc-top {
	position: relative;
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 13px 15px;
	border-bottom: 1.5px solid #eef3f0;
	background: linear-gradient(180deg, #f7fbf9, #fff);
	flex: none;
}

.aknpc-ava {
	width: 46px;
	height: 46px;
	flex: none;
	display: grid;
	place-items: center;
	border-radius: 14px;
	background: #eef6f3;
	border: 1.5px solid #dbe8e2;
	overflow: hidden;
}

.aknpc-ava svg { width: 34px; height: 41px; }

.aknpc-dlg[data-t="cui"] .aknpc-ava { background: #eaf7f4; border-color: #bfe6dc; }
.aknpc-dlg[data-t="chen"] .aknpc-ava { background: #eaf1fe; border-color: #c3d7fb; }
.aknpc-dlg[data-t="yang"] .aknpc-ava { background: #f2ecfe; border-color: #d7c8fb; }

.aknpc-who { flex: 1; min-width: 0; }

.aknpc-who b {
	display: block;
	font-size: 15.5px;
	font-weight: 800;
	letter-spacing: .2px;
	color: #0f172a;
}

.aknpc-who small {
	display: block;
	margin-top: 1px;
	font-size: 11.5px;
	color: #64748b;
}

.aknpc-tagchip {
	display: inline-block;
	margin-left: 6px;
	padding: 1px 7px;
	border-radius: 999px;
	font-size: 10.5px;
	font-weight: 700;
	vertical-align: 1px;
	background: #eef2f7;
	color: #475569;
}

.aknpc-dlg[data-t="cui"] .aknpc-tagchip { background: #e3f5f0; color: #0f766e; }
.aknpc-dlg[data-t="chen"] .aknpc-tagchip { background: #e6eeff; color: #1d4ed8; }
.aknpc-dlg[data-t="yang"] .aknpc-tagchip { background: #f0e9fe; color: #6d28d9; }

.aknpc-score {
	margin-left: auto;
	flex: none;
	padding: 4px 10px;
	border-radius: 999px;
	background: #fff7e6;
	border: 1.5px solid #fde3b0;
	color: #b45309;
	font-size: 11.5px;
	font-weight: 700;
	white-space: nowrap;
}

.aknpc-x {
	flex: none;
	width: 30px;
	height: 30px;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: #94a3b8;
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
	transition: background .15s, color .15s;
}

.aknpc-x:hover { background: #f1f5f9; color: #475569; }

/* 正文 */
.aknpc-body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 14px 15px 4px;
	-webkit-overflow-scrolling: touch;
}

.aknpc-body::-webkit-scrollbar { width: 8px; }
.aknpc-body::-webkit-scrollbar-thumb { background: #dbe3e8; border-radius: 99px; }

/* 老师说的话 */
.aknpc-say {
	display: flex;
	gap: 9px;
	margin-bottom: 12px;
}

.aknpc-say p {
	margin: 0;
	padding: 9px 12px;
	border-radius: 4px 14px 14px 14px;
	background: #f1f6f4;
	color: #14231c;
	line-height: 1.62;
	font-size: 13.5px;
}

.aknpc-dlg[data-t="chen"] .aknpc-say p { background: #eef3fe; }
.aknpc-dlg[data-t="yang"] .aknpc-say p { background: #f5f0fe; }

.aknpc-say p b { color: #0f172a; }

/* 古诗卡 */
.aknpc-poem {
	margin: 4px 0 12px;
	padding: 16px 14px 14px;
	border-radius: 16px;
	background: linear-gradient(180deg, #fbfdfb, #f4f8f5);
	border: 1.5px solid #e2ece6;
	text-align: center;
}

.aknpc-poem-h b {
	display: block;
	font-size: 16px;
	font-weight: 800;
	letter-spacing: 1px;
	color: #12271d;
}

.aknpc-poem-h span {
	display: block;
	margin-top: 2px;
	font-size: 11.5px;
	color: #6b7f74;
}

.aknpc-poem-l {
	margin-top: 12px;
	display: flex;
	flex-direction: column;
	gap: 3px;
	font-size: 16px;
	line-height: 1.95;
	letter-spacing: 2px;
	color: #1b2b23;
	font-family: "Kaiti SC", "KaiTi", "STKaiti", "Songti SC", "SimSun", serif;
}

.aknpc-poem-l i {
	font-style: normal;
	opacity: 0;
	transform: translateY(4px);
	animation: aknpcIn .42s ease forwards;
}

.aknpc-poem-tip {
	margin-top: 12px;
	padding-top: 10px;
	border-top: 1px dashed #d7e5dd;
	font-size: 12.5px;
	line-height: 1.7;
	color: #3f564b;
	text-align: left;
}

.aknpc-poem-tip b { color: #0f766e; }

/* 公式 */
.aknpc-topiclist {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 10px;
}

.aknpc-topic {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 11px 13px;
	border-radius: 13px;
	border: 1.5px solid #e6edf3;
	background: #fbfcfe;
	color: #17233a;
	font-size: 13.5px;
	font-weight: 700;
	text-align: left;
	cursor: pointer;
	transition: border-color .15s, background .15s, transform .12s;
}

.aknpc-topic:hover {
	border-color: #b9cdf5;
	background: #f4f8ff;
	transform: translateX(2px);
}

.aknpc-topic i {
	flex: none;
	width: 26px;
	height: 26px;
	display: grid;
	place-items: center;
	border-radius: 8px;
	background: #e8f0ff;
	color: #1d4ed8;
	font-style: normal;
	font-size: 14px;
}

.aknpc-dlg[data-t="yang"] .aknpc-topic i { background: #f0e9fe; color: #6d28d9; }
.aknpc-dlg[data-t="cui"] .aknpc-topic i { background: #e3f5f0; color: #0f766e; }

.aknpc-topic span { flex: 1; min-width: 0; }
.aknpc-topic small { display: block; margin-top: 2px; font-size: 11px; color: #7c8b9a; font-weight: 500; }

.aknpc-fmlbox {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 12px;
}

.aknpc-fml {
	padding: 10px 13px;
	border-radius: 13px;
	background: #fbfcff;
	border: 1.5px solid #e3ebf6;
}

.aknpc-fml .f {
	display: block;
	font-family: "Cambria Math", "Latin Modern Math", Cambria, Georgia, "Times New Roman", serif;
	font-size: 16.5px;
	line-height: 1.7;
	color: #12203a;
	word-break: break-word;
}

.aknpc-fml .u {
	display: block;
	margin-top: 3px;
	font-size: 12px;
	line-height: 1.6;
	color: #5a6b82;
}

.aknpc-fml sup, .aknpc-fml sub { font-size: .72em; }

/* 快捷键表 */
.aknpc-sclist {
	display: flex;
	flex-direction: column;
	gap: 7px;
	margin-bottom: 12px;
}

.aknpc-sc {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 9px 11px;
	border-radius: 12px;
	background: #fbfaff;
	border: 1.5px solid #eae4fa;
}

.aknpc-keys { flex: none; display: flex; align-items: center; gap: 3px; flex-wrap: nowrap; max-width: 158px; }

.aknpc-k {
	display: inline-block;
	padding: 2.5px 6px;
	border-radius: 6px;
	background: #fff;
	border: 1px solid #d6cbf2;
	border-bottom-width: 2.5px;
	color: #4c1d95;
	font-family: Consolas, "SF Mono", Menlo, monospace;
	font-size: 11.5px;
	font-weight: 700;
	line-height: 1.3;
	white-space: nowrap;
}

.aknpc-plus { color: #a89bd0; font-size: 10px; }

.aknpc-sc .u { flex: 1; min-width: 0; font-size: 12.5px; line-height: 1.55; color: #2a2f45; }
.aknpc-sc .u b { display: block; font-size: 13px; color: #1e1b33; }
.aknpc-sc .u em {
	display: block;
	margin-top: 2px;
	font-style: normal;
	font-size: 11.5px;
	color: #7c6fa8;
}

/* 小考 */
.aknpc-q {
	padding: 13px 14px;
	border-radius: 14px;
	background: #f8fafc;
	border: 1.5px solid #e5ecf3;
	font-size: 14.5px;
	font-weight: 700;
	line-height: 1.65;
	color: #14223a;
	margin-bottom: 10px;
}

.aknpc-q small {
	display: block;
	margin-bottom: 4px;
	font-size: 11px;
	font-weight: 700;
	color: #94a3b8;
	letter-spacing: .5px;
}

.aknpc-qopts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }

.aknpc-opt {
	display: flex;
	align-items: center;
	gap: 9px;
	width: 100%;
	padding: 10px 12px;
	border-radius: 12px;
	border: 1.5px solid #e2e8f0;
	background: #fff;
	color: #1e2a3a;
	font-size: 13.5px;
	line-height: 1.5;
	text-align: left;
	cursor: pointer;
	transition: border-color .15s, background .15s, transform .12s;
}

.aknpc-opt:hover:not(:disabled) { border-color: #9fb8e0; background: #f7fbff; transform: translateY(-1px); }

.aknpc-opt b {
	flex: none;
	width: 21px;
	height: 21px;
	display: grid;
	place-items: center;
	border-radius: 7px;
	background: #f1f5f9;
	color: #64748b;
	font-size: 11.5px;
	font-weight: 800;
}

.aknpc-opt.is-ok { border-color: #6ee7b7; background: #f0fdf6; }
.aknpc-opt.is-ok b { background: #10b981; color: #fff; }
.aknpc-opt.is-no { border-color: #fca5a5; background: #fff5f5; }
.aknpc-opt.is-no b { background: #ef4444; color: #fff; }
.aknpc-opt:disabled { cursor: default; }

.aknpc-why {
	margin: 2px 0 8px;
	padding: 10px 12px;
	border-radius: 12px;
	font-size: 12.5px;
	line-height: 1.65;
	background: #f0fdf6;
	border: 1.5px solid #bbf7d0;
	color: #14532d;
	animation: aknpcIn .25s ease;
}

.aknpc-why.is-bad { background: #fffaf0; border-color: #fde68a; color: #78350f; }
.aknpc-why b { font-weight: 800; }

/* 底部按钮 */
.aknpc-opts {
	flex: none;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 11px 15px 14px;
	border-top: 1.5px solid #eef3f0;
	background: #fff;
}

.aknpc-btn {
	flex: 1 1 auto;
	min-width: 108px;
	padding: 10px 14px;
	border-radius: 12px;
	border: 1.5px solid #e2e8f0;
	background: #fff;
	color: #334155;
	font-size: 13.5px;
	font-weight: 700;
	cursor: pointer;
	transition: transform .12s, box-shadow .15s, background .15s, border-color .15s;
}

.aknpc-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(15, 23, 42, .08); }
.aknpc-btn:active { transform: translateY(0); }

.aknpc-btn.is-primary {
	border-color: transparent;
	background: linear-gradient(180deg, #159a6f, #0f7a56);
	color: #fff;
	box-shadow: 0 6px 16px rgba(16, 122, 86, .28);
}

.aknpc-dlg[data-t="chen"] .aknpc-btn.is-primary { background: linear-gradient(180deg, #3b82f6, #1d4ed8); box-shadow: 0 6px 16px rgba(29, 78, 216, .3); }
.aknpc-dlg[data-t="yang"] .aknpc-btn.is-primary { background: linear-gradient(180deg, #8b5cf6, #6d28d9); box-shadow: 0 6px 16px rgba(109, 40, 217, .3); }

.aknpc-btn.is-ghost { background: #f8fafc; color: #64748b; border-color: #e8eef3; }

@keyframes aknpcIn {
	from { opacity: 0; transform: translateY(5px); }
	to { opacity: 1; transform: translateY(0); }
}

/* 手机 */
@media (max-width: 620px) {
	.aknpc-dlg { padding: 0; align-items: flex-end; }
	.aknpc-box {
		max-width: 100%;
		max-height: 84vh;
		border-radius: 18px 18px 0 0;
		border-bottom: 0;
	}
	.aknpc-body { padding: 12px 13px 2px; }
	.aknpc-opts { padding: 10px 13px calc(12px + env(safe-area-inset-bottom, 0px)); }
	.aknpc-btn { flex: 1 1 calc(50% - 4px); min-width: 0; font-size: 13px; padding: 9px 10px; }
	.aknpc-poem-l { font-size: 15px; letter-spacing: 1px; }
	.aknpc-fml .f { font-size: 15.5px; }
	.aknpc-sc { gap: 8px; }
	.aknpc-keys { max-width: 120px; }
	.aknpc-k { font-size: 10.5px; padding: 2px 5px; }
	.aknpc-bub { max-width: 108px; font-size: 10px; }
}
