* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #0a0d0a;
  color: #d4ddc4;
  font-family: "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  overflow: hidden;
  min-height: 100vh;
}

/* ═══ 登录界面 ═══ */
.login-screen {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.login-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 40% 60%, #1a2a18 0%, #0a0d0a 70%);
  overflow: hidden;
}

.login-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-particle {
  position: absolute;
  border-radius: 50%;
  background: #8be06c;
  opacity: 0;
  animation: floatParticle 6s ease-in-out infinite;
}

@keyframes floatParticle {
  0%, 100% { opacity: 0; transform: translateY(0); }
  30% { opacity: 0.7; }
  50% { opacity: 0.4; transform: translateY(-80px); }
  70% { opacity: 0.15; }
}

.login-card {
  position: relative;
  z-index: 2;
  width: 380px;
  max-width: 90vw;
  background: linear-gradient(135deg, rgba(24,32,24,0.95), rgba(16,24,16,0.92));
  border: 1px solid #3a5230;
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 0 60px rgba(106,164,80,0.12), 0 8px 32px rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
}

.login-title {
  text-align: center;
  font-size: 2.2rem;
  letter-spacing: 6px;
  color: #dff5d6;
  margin-bottom: 4px;
  font-weight: 700;
  text-shadow: 0 0 20px rgba(122,200,100,0.3);
}

.login-subtitle {
  text-align: center;
  color: #8a9e7c;
  font-size: 0.95rem;
  margin-bottom: 28px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  color: #b4c8a8;
  font-size: 0.9rem;
}

.login-field input,
.login-field select {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #4b6246;
  background: #0f140f;
  color: #edf5e8;
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.login-field input:focus,
.login-field select:focus {
  border-color: #8be06c;
  outline: none;
  box-shadow: 0 0 8px rgba(106,164,80,0.2);
}

.login-btn {
  width: 100%;
  padding: 14px;
  margin-top: 8px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #6ab450, #4a8c34);
  color: #17200f;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 2px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(106,164,80,0.35);
}

.login-btn:active {
  transform: translateY(0);
}

.login-error {
  text-align: center;
  color: #e06050;
  margin-top: 12px;
  min-height: 20px;
  font-size: 0.9rem;
}

/* ═══ 游戏界面 ═══ */
.game-screen {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #20291f;
  cursor: crosshair;
}

/* ═══ 点击提示 ═══ */
.click-hint {
  position: absolute;
  pointer-events: none;
  background: rgba(0,0,0,0.75);
  color: #dff5d6;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 13px;
  border: 1px solid #4b6246;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 20;
}
.click-hint.show { opacity: 1; }

/* ═══ 右键菜单 ═══ */
.context-menu {
  position: absolute;
  pointer-events: auto;
  background: rgba(16,24,16,0.96);
  border: 1px solid #4b6246;
  border-radius: 8px;
  padding: 4px 0;
  min-width: 150px;
  z-index: 30;
  display: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.context-menu.show { display: block; }
.context-menu-item {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  color: #d4ddc4;
  transition: background 0.1s;
}
.context-menu-item:hover { background: #2a3a20; }
.context-menu-item.danger { color: #e08070; }
.context-menu-divider {
  border: none;
  border-top: 1px solid #3a4a30;
  margin: 4px 0;
}

/* ═══ HUD 左上 ═══ */
.hud {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(10,14,10,0.88);
  border: 1px solid #3a4a30;
  border-radius: 10px;
  padding: 14px;
  min-width: 200px;
  max-width: 240px;
  backdrop-filter: blur(4px);
  z-index: 10;
}

.hud-char { margin-bottom: 10px; }
.hud-name { font-size: 1.15rem; font-weight: 700; color: #fff3a1; }
.hud-realm { font-size: 0.85rem; color: #8a9e7c; margin-top: 2px; }

.hud-bars { display: flex; flex-direction: column; gap: 6px; }
.hud-bar-row { display: flex; align-items: center; gap: 8px; }
.hud-bar-label { font-size: 0.8rem; color: #9ab08a; width: 32px; text-align: right; }
.hud-bar-track { flex: 1; height: 8px; background: #1a2218; border-radius: 4px; overflow: hidden; }
.hud-bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
.hud-bar-fill.hp { background: linear-gradient(90deg, #e06050, #ff7a55); }
.hud-bar-fill.qi { background: linear-gradient(90deg, #4a90d9, #72b7ff); }
.hud-bar-fill.cult { background: linear-gradient(90deg, #b890d4, #d4b0f0); }
.hud-bar-num { font-size: 0.75rem; color: #b4c8a8; width: 56px; }

.hud-inventory {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.hud-item {
  padding: 2px 8px;
  background: #1a2218;
  border: 1px solid #3a4a30;
  border-radius: 4px;
  font-size: 0.72rem;
  color: #c8d8b8;
}

/* ═══ HUD 右上 ═══ */
.hud-right {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.hud-status {
  padding: 4px 12px;
  background: rgba(10,14,10,0.88);
  border: 1px solid #3a4a30;
  border-radius: 6px;
  font-size: 0.8rem;
  color: #8a9e7c;
}

.hud-server-info {
  padding: 6px 12px;
  background: rgba(10,14,10,0.88);
  border: 1px solid #3a4a30;
  border-radius: 6px;
  font-size: 0.78rem;
  color: #9ab08a;
  display: flex;
  gap: 12px;
}

/* ═══ HUD 右下 AI 用量 ═══ */
.hud-llm {
  position: absolute;
  bottom: 60px;
  right: 16px;
  background: rgba(10,14,10,0.88);
  border: 1px solid #3a4a30;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.72rem;
  color: #9ab08a;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 180px;
}
.hud-llm-title { font-weight: 700; color: #b4c8a8; margin-bottom: 2px; }

/* ═══ 事件日志 左下 ═══ */
.event-log {
  position: absolute;
  bottom: 60px;
  left: 16px;
  max-width: 380px;
  max-height: 180px;
  overflow: hidden;
  z-index: 10;
  pointer-events: none;
}

#events {
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
}

.event {
  padding: 4px 10px;
  background: rgba(16,24,12,0.82);
  border-left: 2px solid #6ab450;
  border-radius: 2px;
  font-size: 0.78rem;
  color: #c0d4b0;
  animation: fadeInEvent 0.3s ease;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes fadeInEvent {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ═══ 底部操作栏 ═══ */
.action-bar {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 10;
  padding: 8px 16px;
  background: rgba(10,14,10,0.9);
  border: 1px solid #3a4a30;
  border-radius: 10px;
  backdrop-filter: blur(4px);
}

.action-bar button {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid #4b6246;
  background: #1a2218;
  color: #d4ddc4;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}
.action-bar button:hover { background: #2a3a20; }

.action-bar-hint {
  font-size: 0.72rem;
  color: #6a7a5a;
  display: flex;
  align-items: center;
  margin-left: 8px;
}

/* ═══ 弹窗 ═══ */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(2px);
}

.modal-content {
  background: linear-gradient(135deg, rgba(24,32,24,0.97), rgba(16,24,16,0.95));
  border: 1px solid #4b6246;
  border-radius: 12px;
  padding: 24px;
  min-width: 300px;
  max-width: 420px;
  box-shadow: 0 0 40px rgba(0,0,0,0.6);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #dff5d6;
  margin-bottom: 14px;
}

.modal-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.9rem;
  color: #b4c8a8;
  border-bottom: 1px solid #2a3a22;
}

.modal-btn {
  width: 100%;
  padding: 10px;
  margin-top: 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}
.modal-btn.primary { background: #6ab450; color: #17200f; }
.modal-btn.primary:hover { background: #7ac85a; }
.modal-btn.danger { background: #a04030; color: #fdd; }
.modal-btn.cancel { background: #2a302a; color: #b4c8a8; border: 1px solid #4b6246; }

/* ═══ 浮动提示 ═══ */
.toasts {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 60;
  pointer-events: none;
}

.toast {
  padding: 8px 20px;
  background: rgba(16,24,16,0.92);
  border: 1px solid #4b6246;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #dff5d6;
  animation: toastPop 2.2s ease forwards;
}

.toast.good { border-color: #6ab450; color: #b4f0a0; }
.toast.bad { border-color: #e06050; color: #f0a090; }
.toast.info { border-color: #4a90d9; color: #a0c8f0; }

@keyframes toastPop {
  0% { opacity: 0; transform: translateY(10px); }
  15% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-10px); }
}
