* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
	background: #0d1117; color: #e0e0e0;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	user-select: none; -webkit-user-select: none;
}
.hidden { display: none !important; }

/* ---- 大厅 ---- */
.panel {
	position: fixed; inset: 0;
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	padding: 20px;
}
#lobby h1 { font-size: 28px; margin-bottom: 8px; }
#lobby .sub { color: #8b949e; font-size: 14px; margin-bottom: 30px; text-align: center; }
.form { width: 100%; max-width: 340px; }
.form .row { margin-bottom: 16px; }
.form label { display: block; font-size: 13px; color: #8b949e; margin-bottom: 6px; }
.form input {
	width: 100%; padding: 12px 14px; background: #161b22; border: 1px solid #30363d;
	color: #e0e0e0; border-radius: 8px; font-size: 16px;
}
.form input:focus { outline: none; border-color: #58a6ff; }
.btn {
	cursor: pointer; border: none; border-radius: 8px; padding: 10px 16px;
	font-size: 14px; transition: all 0.2s;
}
.btn.primary { width: 100%; background: #238636; color: #fff; font-size: 16px; padding: 14px; }
.btn.primary:hover { background: #2ea043; }
.btn.primary:disabled { opacity: 0.5; }
.btn.tiny { background: #21262d; color: #c9d1d9; padding: 6px 10px; font-size: 12px; border: 1px solid #30363d; }
.hint { color: #8b949e; font-size: 12px; margin-top: 8px; text-align: center; }
.tips { margin-top: 30px; max-width: 340px; }
.tips h3 { font-size: 14px; color: #58a6ff; margin-bottom: 8px; }
.tips ul { list-style: none; }
.tips li { font-size: 12px; color: #8b949e; margin-bottom: 6px; }

/* ---- 游戏界面 ---- */
#gameWrap { position: fixed; inset: 0; }
#gameCanvas { display: block; width: 100%; height: 100%; }

/* 顶部 HUD */
#topHud {
	position: fixed; top: 0; left: 0; right: 0;
	display: flex; justify-content: space-between; align-items: flex-start;
	padding: 8px 12px; pointer-events: none; z-index: 10;
}
.hud-left { display: flex; flex-direction: column; gap: 4px; }
.hud-level { font-size: 16px; font-weight: bold; color: #58a6ff; }
.hud-bar-wrap { position: relative; width: 180px; height: 16px; }
.hud-bar {
	width: 100%; height: 10px; background: #21262d; border-radius: 5px;
	border: 1px solid #30363d; overflow: hidden;
}
.hud-bar-fill { height: 100%; border-radius: 4px; transition: width 0.2s; }
.hud-bar.hp .hud-bar-fill { background: #f85149; }
.hud-bar.exp .hud-bar-fill { background: #d29922; }
.hud-bar-text {
	position: absolute; top: 0; left: 0; right: 0; text-align: center;
	font-size: 9px; color: #e0e0e0; line-height: 12px; text-shadow: 0 0 3px #000;
}
.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.hud-right span { font-size: 11px; color: #8b949e; }
.hud-right .btn { pointer-events: auto; }

/* 事件列表 */
#eventList {
	position: fixed; bottom: 80px; left: 10px;
	width: 240px; max-height: 120px; overflow: hidden;
	pointer-events: none; z-index: 10;
}
#eventList .ev {
	background: rgba(13, 17, 23, 0.85); color: #c9d1d9;
	font-size: 11px; padding: 4px 8px; margin-bottom: 3px;
	border-radius: 4px; border-left: 3px solid #58a6ff;
	animation: fadeIn 0.3s;
}
@keyframes fadeIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }

/* 升级提示 */
.levelup-flash {
	position: fixed; top: 40%; left: 50%; transform: translate(-50%, -50%);
	font-size: 24px; font-weight: bold; color: #d29922;
	text-shadow: 0 0 20px rgba(210, 153, 34, 0.8);
	z-index: 20; animation: bounce 0.5s;
}
@keyframes bounce { 0% { transform: translate(-50%, -50%) scale(0.5); } 50% { transform: translate(-50%, -50%) scale(1.2); } 100% { transform: translate(-50%, -50%) scale(1); } }

/* 死亡遮罩 */
.death-overlay {
	position: fixed; inset: 0; background: rgba(0, 0, 0, 0.8);
	display: flex; align-items: center; justify-content: center;
	z-index: 30;
}
.death-text { text-align: center; }
.death-text h2 { font-size: 28px; color: #f85149; margin-bottom: 12px; }
.death-text p { color: #8b949e; font-size: 14px; }
.respawn-timer { font-size: 48px; font-weight: bold; color: #f85149; }

/* 装备面板 */
.equip-panel {
	position: fixed; top: 50px; right: 10px;
	width: 280px; background: rgba(13, 17, 23, 0.95);
	border: 1px solid #30363d; border-radius: 8px;
	padding: 12px; z-index: 15; max-height: 60vh; overflow-y: auto;
}
.equip-panel h3 { font-size: 14px; margin-bottom: 10px; color: #58a6ff; }
.equip-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.equip-slot {
	display: flex; align-items: center; gap: 6px;
	padding: 8px; background: #161b22; border: 1px solid #30363d;
	border-radius: 6px; font-size: 12px;
}
.equip-slot.empty { opacity: 0.4; }
.eq-icon { font-size: 16px; }
.eq-name { font-weight: bold; }
.eq-rarity { font-size: 10px; }
.eq-stats { flex: 1; color: #8b949e; font-size: 11px; }
.btn-unequip {
	background: #21262d; border: 1px solid #f85149; color: #f85149;
	border-radius: 4px; padding: 2px 8px; font-size: 11px; cursor: pointer;
}
.stat-summary {
	display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
	padding-top: 8px; border-top: 1px solid #30363d;
}
.stat-summary span { font-size: 11px; color: #8b949e; }
.stat-summary b { color: #e0e0e0; }

/* 四向移动按钮 */
#dpad {
	position: fixed; bottom: 15px; left: 15px;
	width: 140px; height: 140px; z-index: 15;
}
.dpad-btn {
	position: absolute; width: 46px; height: 46px;
	background: rgba(33, 38, 45, 0.85); border: 1px solid #30363d;
	color: #c9d1d9; border-radius: 8px; font-size: 20px;
	cursor: pointer; touch-action: none;
	display: flex; align-items: center; justify-content: center;
}
.dpad-btn:active { background: #58a6ff; color: #fff; }
.dpad-up { top: 0; left: 47px; }
.dpad-down { bottom: 0; left: 47px; }
.dpad-left { top: 47px; left: 0; }
.dpad-right { top: 47px; right: 0; }

/* 手机适配 */
@media (max-width: 480px) {
	#lobby h1 { font-size: 22px; }
	.hud-bar-wrap { width: 140px; }
	.equip-panel { width: calc(100vw - 20px); right: 10px; }
	#dpad { width: 120px; height: 120px; }
	.dpad-btn { width: 38px; height: 38px; font-size: 16px; }
	.dpad-up { left: 41px; }
	.dpad-down { left: 41px; }
	.dpad-left { top: 41px; }
	.dpad-right { top: 41px; }
}
