/* css/mp.css — 多人模式：对齐主菜单金色暗黑风 */
.mp-root { position: fixed; inset: 0; z-index: 1400; display: flex; align-items: center; justify-content: center; font-family: inherit;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); box-sizing: border-box; }
.mp-root.mp-hidden { display: none; }
.mp-bg { position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 40%, #0a0a14 0%, #020204 75%); }
.mp-stage { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 2rem 1rem; box-sizing: border-box;
  overflow-y: auto; color: #cfcfd6; }

/* ---------- 载入动画（字符汇聚 + 金光扫过）---------- */
.mp-loading { text-align: center; }
.mp-load-txt { font-size: 1.1rem; letter-spacing: 0.6em; color: #e8dcbf;
  text-shadow: 0 0 24px rgba(184,155,94,0.5); animation: flicker 6s infinite; }
.mp-load-bar { width: 220px; height: 1px; margin: 22px auto 0; background: rgba(120,120,140,0.2); overflow: hidden; }
.mp-load-bar i { display: block; width: 40%; height: 100%; background: linear-gradient(90deg, transparent, #b89b5e, transparent);
  animation: mpSlide 1.6s ease-in-out infinite; }
@keyframes mpSlide { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }

/* ---------- 卡片 ---------- */
.mp-card { background: rgba(18,18,26,0.85); border: 1px solid rgba(120,120,140,0.28);
  border-radius: 8px; padding: 2rem 1.8rem; max-width: 420px; width: 86vw; box-sizing: border-box;
  text-align: center; box-shadow: 0 0 40px rgba(0,0,0,0.6); animation: game-fade-in 0.5s ease; }
.mp-card h2 { margin: 0 0 1.2rem; font-size: 1.3rem; font-weight: 400; letter-spacing: 0.4em;
  color: #e8dcbf; text-shadow: 0 0 20px rgba(184,155,94,0.4); }
.mp-card p { color: #6a6a76; font-size: 0.85rem; line-height: 1.9; letter-spacing: 0.1em; }
.mp-warn { border-color: rgba(184,120,94,0.4); }

/* ---------- 按钮（复用 menu-btn 风格）---------- */
.mp-btn { display: inline-block; margin: 0.35rem 0.25rem; padding: 0.85rem 1.4rem; font-family: inherit;
  font-size: 0.95rem; letter-spacing: 0.3em; color: #cfcfd6; background: rgba(18,18,26,0.7);
  border: 1px solid rgba(120,120,140,0.28); border-radius: 6px; cursor: pointer;
  transition: all 0.25s ease; -webkit-tap-highlight-color: transparent; text-align: center; }
.mp-btn:hover, .mp-btn:active { color: #fff; border-color: rgba(184,155,94,0.75);
  background: rgba(184,155,94,0.14); box-shadow: 0 0 22px rgba(184,155,94,0.28); }
.mp-btn:disabled { opacity: 0.3; cursor: not-allowed; box-shadow: none; }
.mp-btn.mp-primary { color: #e8dcbf; border-color: rgba(184,155,94,0.55); background: rgba(184,155,94,0.1); }
.mp-btn.mp-primary:hover { box-shadow: 0 0 30px rgba(184,155,94,0.5); }
.mp-btn.mp-danger { color: #d6a0a0; border-color: rgba(184,94,94,0.4); background: rgba(184,94,94,0.08); }
.mp-btn.mp-danger:hover { border-color: rgba(184,94,94,0.75); box-shadow: 0 0 22px rgba(184,94,94,0.3); }
.mp-btn.mp-ghost { background: transparent; border-color: rgba(120,120,140,0.2); color: #6a6a76; }
.mp-btn.mp-small { padding: 0.5rem 0.9rem; font-size: 0.8rem; letter-spacing: 0.2em; }
.mp-btn.mp-tiny { padding: 0.15rem 0.6rem; font-size: 0.7rem; letter-spacing: 0.1em; }
.mp-input { width: 100%; box-sizing: border-box; padding: 0.9rem; margin: 0.8rem 0; background: rgba(10,10,16,0.8);
  border: 1px solid rgba(120,120,140,0.28); border-radius: 6px; color: #e8dcbf; font-size: 1.2rem;
  text-align: center; letter-spacing: 0.4em; font-family: inherit; }
.mp-input:focus { outline: none; border-color: rgba(184,155,94,0.6); box-shadow: 0 0 16px rgba(184,155,94,0.2); }

/* ---------- 大厅 ---------- */
.mp-head { width: min(480px, 88vw); display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1.4rem; }
.mp-title { font-size: 1.5rem; letter-spacing: 0.4em; color: #e8dcbf; text-shadow: 0 0 24px rgba(184,155,94,0.4); }
.mp-sub { font-size: 0.75rem; color: #6a6a76; letter-spacing: 0.2em; }
.mp-me { font-size: 0.8rem; color: #6a6a76; }
.mp-me b { color: #b89b5e; font-weight: 400; }
.mp-menu { display: flex; flex-direction: column; gap: 1rem; width: min(320px, 82vw); margin-bottom: 1.6rem; }
.mp-list-wrap { width: min(480px, 88vw); }
.mp-list-title { font-size: 0.8rem; color: #6a6a76; margin-bottom: 0.6rem; letter-spacing: 0.3em; }
.mp-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 200px; overflow-y: auto; }
.mp-empty { color: #4a4a54; font-size: 0.85rem; padding: 1rem; text-align: center; letter-spacing: 0.2em; }
.mp-room-row { display: flex; align-items: center; gap: 0.7rem; padding: 0.8rem 1rem;
  background: rgba(18,18,26,0.6); border: 1px solid rgba(120,120,140,0.2); border-radius: 6px; font-size: 0.85rem; }
.mp-room-code { font-family: monospace; letter-spacing: 0.2em; color: #b89b5e; }
.mp-room-host { flex: 1; color: #cfcfd6; }
.mp-room-cnt { color: #6a6a76; }
.mp-foot { margin-top: 1.4rem; display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }
.mp-alert { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center;
  justify-content: center; z-index: 1520; animation: game-fade-in 0.3s ease; }
.mp-alert-in { background: rgba(18,18,26,0.95); padding: 1.6rem 2rem; border-radius: 8px;
  border: 1px solid rgba(184,155,94,0.3); text-align: center; max-width: 320px; color: #cfcfd6;
  box-shadow: 0 0 40px rgba(0,0,0,0.6); }

/* ---------- 房间 ---------- */
.mp-codewrap { display: flex; align-items: center; gap: 0.7rem; margin: 1rem 0 1.4rem; }
.mp-codepre { font-size: 0.75rem; color: #6a6a76; letter-spacing: 0.2em; }
.mp-codebig { font-family: monospace; font-size: 1.8rem; letter-spacing: 0.4em; color: #e8dcbf;
  text-shadow: 0 0 24px rgba(184,155,94,0.5); }
.mp-seats { display: flex; flex-direction: column; gap: 0.6rem; width: min(360px, 82vw); margin-bottom: 1.2rem; }
.mp-seat { display: flex; align-items: center; gap: 0.6rem; padding: 0.85rem 1.1rem;
  background: rgba(18,18,26,0.6); border: 1px solid rgba(120,120,140,0.2); border-radius: 6px;
  font-size: 0.95rem; letter-spacing: 0.15em; transition: all 0.3s; }
.mp-seat.me { border-color: rgba(184,155,94,0.6); background: rgba(184,155,94,0.08);
  box-shadow: 0 0 20px rgba(184,155,94,0.15); }
.mp-seat-name { flex: 1; }
.mp-crown { color: #b89b5e; }
.mp-empty-seat { color: #3a3a44; font-style: italic; justify-content: center; letter-spacing: 0.3em; }
.mp-wait { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; color: #6a6a76;
  letter-spacing: 0.2em; margin-bottom: 0.6rem; animation: breathe 2.4s ease-in-out infinite; }
.mp-wait-dot { width: 6px; height: 6px; border-radius: 50%; background: #b89b5e;
  box-shadow: 0 0 10px rgba(184,155,94,0.8); }

/* ---------- 对局 ---------- */
.mpg-top { width: 100%; display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 1rem; font-size: 0.85rem; letter-spacing: 0.2em; box-sizing: border-box; color: #6a6a76; }
.mpg-hpbar { position: relative; flex: 1; max-width: 160px; height: 14px; margin: 0 0.8rem;
  background: rgba(30,30,40,0.8); border: 1px solid rgba(184,94,94,0.4); border-radius: 7px; overflow: hidden; }
.mpg-hpbar i { display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, #d66a6a, #e88a6a); transition: width 0.3s ease; }
.mpg-hpbar em { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-style: normal; font-size: 0.7rem; letter-spacing: 0.1em; color: #fff; text-shadow: 0 0 4px rgba(0,0,0,0.8); }
.mpg-turn { color: #e8dcbf; text-shadow: 0 0 16px rgba(184,155,94,0.5); }
.mpg-board { flex: 1; width: 100%; overflow: hidden; position: relative; display: flex;
  align-items: center; justify-content: center; }
.mpm-wrap { position: relative; width: 100%; height: 100%; overflow: hidden; }
.mpm-cells { position: absolute; left: 0; top: 0; transition: transform 0.35s ease-out; }
.mpm-layer { position: absolute; inset: 0; pointer-events: none; }
/* 投掷物（火/召唤物/陷阱） */
.mpm-item {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}
.mpm-item-fire {
  color: #ff9a4a;
  text-shadow: 0 0 10px rgba(255,140,60,0.9), 0 0 22px rgba(255,80,30,0.6);
  animation: itemFireFlicker 0.5s ease-in-out infinite alternate;
}
@keyframes itemFireFlicker {
  0%   { transform: scale(0.95); opacity: 0.85; }
  100% { transform: scale(1.1); opacity: 1; }
}
.mpm-item-summon { color: #b8a0ff; text-shadow: 0 0 10px rgba(160,130,255,0.9); }
.mpm-item-trap { color: #d0c090; text-shadow: 0 0 8px rgba(200,180,120,0.7); }

.mpm-fog { position: absolute; inset: 0; pointer-events: none; z-index: 4;
  /* 由 JS 设置 background radial-gradient */ }
.mpm-cell { position: absolute; box-sizing: border-box; border: 1px solid rgba(120,120,140,0.05); }
.mpm-wall { background: rgba(2,2,4,0.9); border-color: rgba(0,0,0,0.6); }
.mpm-bench { background: rgba(184,155,94,0.1); border-color: rgba(184,155,94,0.4); color: #b89b5e;
  display: flex; align-items: center; justify-content: center; font-size: 0.9rem;
  text-shadow: 0 0 10px rgba(184,155,94,0.6); }
.mpm-word { position: absolute; display: flex; align-items: center; justify-content: center;
  color: #b8d4a0; text-shadow: 0 0 12px rgba(140,200,120,0.5); animation: breathe 2.8s ease-in-out infinite; }
.mpm-player { position: absolute; display: flex; align-items: center; justify-content: center;
  color: #e8dcbf; background: rgba(184,155,94,0.18); border: 1px solid rgba(184,155,94,0.4);
  border-radius: 4px; z-index: 3; transition: left 0.3s, top 0.3s; }
.mpm-player.me { background: rgba(184,155,94,0.35); box-shadow: 0 0 16px rgba(184,155,94,0.5); }
.mpm-player.turn { outline: 1px solid #e8dcbf; animation: flicker 2s infinite; }
.mpm-hp { position: absolute; top: -9px; right: -6px; font-size: 0.6rem; background: rgba(10,10,16,0.9);
  border-radius: 5px; padding: 0 3px; color: #d6a0a0; }
.mpg-log { position: fixed !important; top: calc(3.8rem + env(safe-area-inset-top, 0px)) !important;
  left: 0.8rem !important; right: auto !important; bottom: auto !important;
  z-index: 1620 !important;
  max-width: 46vw; font-size: 0.72rem; color: #8a8a96; text-align: left;
  line-height: 1.55; letter-spacing: 0.05em; pointer-events: none; }
.mpg-hud { width: 100%; display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem 1rem;
  box-sizing: border-box; flex-wrap: wrap; justify-content: center; }
.mpg-hp { font-size: 0.85rem; color: #d6a0a0; letter-spacing: 0.1em; }
.mpg-bag { display: flex; gap: 0.3rem; align-items: center; }
.mpg-baglabel { font-size: 0.7rem; color: #6a6a76; margin-right: 0.3rem; letter-spacing: 0.2em; }
.mpg-slot { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  background: rgba(18,18,26,0.7); border: 1px solid rgba(120,120,140,0.28); border-radius: 5px;
  font-size: 1.1rem; cursor: pointer; transition: all 0.2s; color: #cfcfd6; }
.mpg-slot.sel { border-color: rgba(184,155,94,0.9); box-shadow: 0 0 14px rgba(184,155,94,0.5); color: #e8dcbf; }
.mpg-slot.empty { opacity: 0.25; }
.mpg-acts { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.mpg-flash { position: fixed; top: 38%; left: 50%; transform: translate(-50%,-50%);
  background: rgba(18,18,26,0.95); padding: 0.9rem 1.6rem; border-radius: 6px;
  border: 1px solid rgba(184,155,94,0.4); color: #e8dcbf; z-index: 1600; letter-spacing: 0.2em;
  animation: mpFlash 1.4s ease-out forwards; pointer-events: none; box-shadow: 0 0 30px rgba(0,0,0,0.6); }
@keyframes mpFlash { 0% { opacity: 0; transform: translate(-50%,-60%); } 20% { opacity: 1; }
  80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%,-40%); } }

/* ---------- 工作台 / 结算 ---------- */
.mpg-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.75); display: flex;
  align-items: center; justify-content: center; z-index: 1550; animation: game-fade-in 0.3s ease; }
@keyframes mpgModalOut {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes mpgCardOut {
  0%   { opacity: 1; transform: scale(1) translateY(0); }
  100% { opacity: 0; transform: scale(0.88) translateY(20px); }
}
.mpg-modal.closing { animation: mpgModalOut 0.55s ease forwards !important; }
.mpg-modal.closing .mpg-modal-in { animation: mpgCardOut 0.5s cubic-bezier(.4,0,.2,1) forwards !important; }
.mpg-modal-in { background: rgba(18,18,26,0.96); border: 1px solid rgba(184,155,94,0.3);
  border-radius: 10px; padding: 1.8rem 2rem; max-width: 420px; width: 88vw; text-align: center;
  box-shadow: 0 0 50px rgba(0,0,0,0.7); }
.mpg-modal-in h3 { margin: 0 0 1rem; font-weight: 400; letter-spacing: 0.4em; color: #e8dcbf; }
.mpg-modal-in h2 { margin: 0 0 1rem; font-weight: 400; letter-spacing: 0.4em; color: #e8dcbf;
  text-shadow: 0 0 24px rgba(184,155,94,0.5); }
.mpg-benchbag { display: flex; gap: 0.4rem; justify-content: center; flex-wrap: wrap; margin: 1rem 0; }
.mpg-benchout { min-height: 60px; margin: 1rem 0; }
.mpg-hint { color: #6a6a76; font-size: 0.85rem; letter-spacing: 0.2em; }
.mpg-craftok { color: #b8d4a0; font-size: 1rem; letter-spacing: 0.1em; }
.mpg-craftok b { color: #e8dcbf; font-weight: 400; }
.mpg-rank { margin: 1.2rem 0; }
.mpg-rankrow { display: flex; gap: 0.7rem; padding: 0.6rem 0.8rem; border-bottom: 1px solid rgba(120,120,140,0.12);
  font-size: 0.85rem; align-items: center; }
.mpg-rankrow.me { background: rgba(184,155,94,0.08); }
.mpg-rk { color: #b89b5e; width: 1.6rem; }
.mpg-rn { flex: 1; text-align: left; color: #cfcfd6; }
.mpg-rk2, .mpg-rs, .mpg-rh { color: #6a6a76; font-size: 0.75rem; }

/* ---------- 进场动画 ---------- */
.mpg-enter { animation: mpEnter 0.9s ease-out; }
@keyframes mpEnter { 0% { opacity: 0; filter: blur(6px); } 100% { opacity: 1; filter: blur(0); } }

@media (prefers-reduced-motion: reduce) {
  .mp-load-txt, .mp-wait, .mpm-word, .mpm-player.turn { animation: none !important; }
}

/* 座位逐个落下（房间首次渲染） */
@keyframes mpSeatIn {
  0%   { opacity: 0; transform: translateX(-16px) scale(0.96); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}
.mp-seat-in { animation: mpSeatIn 0.5s ease both; }

/* ---------- 多人模式下的层级修正 ---------- */
/* c1-flash 默认 z-index:900，会被 .mp-root(1400) 压住，这里提到最上 */
.mp-root ~ .c1-flash,
body > .c1-flash { z-index: 1450; }

/* 方向键在多人模式显示 */
/* 方向键：显示 + 提到 mpRoot(1400) 之上 */
body.mp-mode .c1-dpad.c1-dpad-fixed,
body.mp-mode #mpDpad {
  display: block !important;
  z-index: 1550 !important;
  left: 50% !important;
  right: auto !important;
  bottom: 1rem !important;
  transform: translateX(-50%) !important;
}
/* 多人独立抽屉：提到多人界面(1400)之上 */
body.mp-mode #mp-drawer { z-index: 1560 !important; }
body.mp-mode #mp-drawer-handle { z-index: 1560 !important; }
/* 背包/工作台面板：盖过多人界面(1400) */
body.mp-mode .c3-panel { z-index: 1550 !important; }
body.mp-mode #mp-drawer-handle { z-index: 1560 !important; }

/* ☰ 抽屉按钮：多人模式下显示 */

/* 底部功能键收缩状态（☰ 控制） */
.mpg-hud.mpg-hud-hide .mpg-acts { display: none; }

/* HUD 按钮换成了 c3-panel-btn，调整间距 */
.mpg-acts { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: center; }
.mpg-acts .c3-panel-btn { margin: 0; }

/* 结算弹层用 c3-panel-btn */
.mpg-settle .c3-panel-btn { margin-top: 1rem; }

/* ---------- 乐观反馈：按钮等待/成功/失败态 ---------- */
.mp-btn.mp-pending,
.c3-panel-btn.mp-pending {
  animation: mpPendPulse 1s ease-in-out infinite;
  opacity: 0.85;
  cursor: wait;
}
@keyframes mpPendPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(184,155,94,0.25); }
  50%      { box-shadow: 0 0 22px rgba(184,155,94,0.7); }
}
.mp-btn.mp-done,
.c3-panel-btn.mp-done {
  border-color: rgba(184,155,94,1) !important;
  background: rgba(184,155,94,0.25) !important;
  color: #fff !important;
}
.mp-btn.mp-fail,
.c3-panel-btn.mp-fail {
  border-color: rgba(184,94,94,0.9) !important;
  background: rgba(184,94,94,0.15) !important;
  animation: mpFailShake 0.4s ease;
}
@keyframes mpFailShake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}


/* 视口高度：优先 dvh */
.mp-root { height: 100vh; height: 100dvh; }


/* 回合开始大字提示 */
.mpg-turn-notice {
  position: fixed;
  left: 50%; top: 38%;
  transform: translate(-50%, -50%);
  z-index: 1700;
  font-size: clamp(1.8rem, 8vw, 3rem);
  letter-spacing: 0.4em;
  color: #e8dcbf;
  text-shadow: 0 0 30px rgba(255,220,140,0.95), 0 0 70px rgba(184,155,94,0.7);
  pointer-events: none;
  animation: turnNoticeIn 1.8s ease forwards;
  white-space: nowrap;
}
.mpg-turn-notice.mpg-dead {
  color: #d6a0a0;
  text-shadow: 0 0 30px rgba(200,90,90,0.95), 0 0 70px rgba(150,50,50,0.7);
}
@keyframes turnNoticeIn {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  18%  { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  30%  { transform: translate(-50%, -50%) scale(1); }
  75%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.08); }
}
