/* ===== 决战疯猫镇 · 客户端样式 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: radial-gradient(circle at 50% 0%, #2b2d42 0%, #1a1b2a 70%);
  color: #f4f1de;
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#app { position: fixed; inset: 0; }

/* 画布 */
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: #141a28; touch-action: none; }
#minimap {
  position: absolute; top: 56px; right: 10px;
  width: 130px; height: 98px;
  border: 2px solid #3d405b; border-radius: 6px;
  background: rgba(20,26,40,.7); display: none; z-index: 5; pointer-events: none;
}

/* HUD */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
#hud.hidden { display: none; }
#hud-top {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  background: rgba(20,26,40,.6); padding: 6px 16px; border-radius: 20px;
  border: 1px solid #3d405b;
}
.score { display: flex; align-items: center; gap: 6px; font-size: 20px; font-weight: 700; }
.score .dot { font-size: 18px; }
.score-cat b { color: #ffd866; }
.score-chicken b { color: #9be7ff; }
#hud-timer { font-size: 22px; font-weight: 800; min-width: 42px; text-align: center; }
#hud-bottom {
  position: absolute; left: 10px; bottom: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
#hud-hpwrap {
  position: relative; width: 180px; height: 18px;
  background: #000; border: 1px solid #3d405b; border-radius: 9px; overflow: hidden;
}
#hud-hp { height: 100%; width: 100%; background: linear-gradient(90deg,#6ee787,#9be7ff); transition: width .12s; }
#hud-hptext { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 18px; text-shadow: 0 1px 2px #000; }
#hud-info { display: flex; gap: 10px; font-size: 13px; background: rgba(20,26,40,.6); padding: 4px 10px; border-radius: 10px; border: 1px solid #3d405b; }
#hud-respawn {
  position: absolute; left: 50%; top: 45%; transform: translate(-50%,-50%);
  font-size: 22px; font-weight: 700; background: rgba(0,0,0,.55); padding: 10px 18px; border-radius: 12px;
}
#hud-respawn.hidden { display: none; }

/* 触摸控制 */
#touch { position: absolute; inset: 0; z-index: 7; pointer-events: none; }
#touch.hidden { display: none; }
.stick {
  position: absolute; bottom: 24px; width: 110px; height: 110px; border-radius: 50%;
  background: rgba(255,255,255,.07); border: 2px solid rgba(255,255,255,.18);
  pointer-events: auto; touch-action: none;
}
#stick-left { left: 24px; }
.stick .knob {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border-radius: 50%; background: rgba(255,255,255,.35); border: 2px solid rgba(255,255,255,.5);
}
#weapon-bar { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 10px; pointer-events: auto; }
.wbtn {
  width: 64px; height: 64px; border-radius: 14px; border: 2px solid #3d405b;
  background: rgba(20,26,40,.7); color: #f4f1de; font-size: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.wbtn small { font-size: 10px; }
.wbtn.active { border-color: #ffd866; background: rgba(255,216,102,.25); }

/* 覆盖层 / 屏幕 */
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(10,12,20,.82); z-index: 20; padding: 16px;
}
.overlay.hidden, .screen.hidden { display: none; }
.card {
  width: min(420px, 92vw); background: #1f2433; border: 2px solid #3d405b; border-radius: 16px;
  padding: 24px; text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.card.wide { width: min(560px, 94vw); }
.card h1 { font-size: 26px; margin-bottom: 6px; }
.card h3 { font-size: 15px; margin: 16px 0 8px; color: #c9cbe0; text-align: left; }
.sub { color: #9aa; font-size: 13px; margin-bottom: 16px; }
input {
  width: 100%; padding: 12px 14px; font-size: 16px; border-radius: 10px; border: 1px solid #3d405b;
  background: #141a28; color: #f4f1de; margin-bottom: 12px; text-align: center;
}
input:focus { outline: none; border-color: #ffd866; }
.btn {
  width: 100%; padding: 12px; font-size: 16px; border-radius: 10px; border: none; cursor: pointer;
  background: #3d405b; color: #f4f1de; font-weight: 600; margin-bottom: 10px;
}
.btn.primary { background: #ffd866; color: #1a1b2a; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:active { transform: scale(.98); }
.row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.row input { margin-bottom: 0; flex: 1; }
.row .btn { margin-bottom: 0; flex: 0 0 auto; width: auto; padding: 12px 16px; }
.row.end { justify-content: space-between; margin-top: 16px; }
.row.end .btn { width: auto; flex: 1; }

/* 阵营选择 */
.faction-pick { display: flex; gap: 12px; margin: 8px 0; }
.fbtn {
  flex: 1; padding: 16px 8px; border-radius: 12px; border: 2px solid #3d405b; cursor: pointer;
  background: #141a28; color: #f4f1de; font-size: 16px; font-weight: 700; display: flex; flex-direction: column; gap: 4px;
}
.fbtn small { font-size: 11px; font-weight: 400; color: #9aa; }
.fbtn.cat.sel { border-color: #ffd866; background: rgba(255,216,102,.2); }
.fbtn.chicken.sel { border-color: #9be7ff; background: rgba(155,231,255,.18); }

/* 房间列表 / 玩家列表 */
.room-list { display: flex; flex-direction: column; gap: 8px; max-height: 30vh; overflow-y: auto; }
.room-item {
  display: flex; justify-content: space-between; align-items: center; padding: 10px 14px;
  background: #141a28; border: 1px solid #3d405b; border-radius: 10px; cursor: pointer;
}
.room-item:hover { border-color: #ffd866; }
.room-item .meta { font-size: 13px; color: #9aa; }
.room-empty { color: #667; font-size: 13px; padding: 8px; }
.room-players { display: flex; flex-direction: column; gap: 6px; max-height: 28vh; overflow-y: auto; }
.player-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: #141a28; border: 1px solid #3d405b; border-radius: 8px; font-size: 14px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 8px; }
.tag.cat { background: rgba(255,216,102,.25); color: #ffd866; }
.tag.chicken { background: rgba(155,231,255,.2); color: #9be7ff; }
.tag.host { background: rgba(255,107,107,.25); color: #ff8a8a; margin-left: 6px; }

/* 结算 */
.result-score { display: flex; justify-content: center; gap: 30px; margin: 8px 0 4px; }
.rs { font-size: 18px; } .rs b { font-size: 26px; }
.rs-cat b { color: #ffd866; } .rs-chicken b { color: #9be7ff; }
.result-list { display: flex; flex-direction: column; gap: 5px; max-height: 34vh; overflow-y: auto; }
.result-row { display: flex; justify-content: space-between; padding: 7px 12px; background: #141a28; border-radius: 8px; font-size: 14px; }
.result-row .nm { flex: 1; text-align: left; }
.result-row .kd { color: #c9cbe0; font-size: 13px; }

#toast {
  position: absolute; top: 80px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.8); color: #ffd866; padding: 8px 16px; border-radius: 10px; z-index: 40; font-size: 14px;
}
#toast.hidden { display: none; }

/* 触摸设备：覆盖层按钮更大，隐藏鼠标提示 */
@media (pointer: coarse) {
  #minimap { display: block; }
  .card h1 { font-size: 22px; }
}
