/* 蛙族枪战 · HUD 样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #111; font-family: "Microsoft YaHei", "Segoe UI", sans-serif; }
#game, #game canvas { position: absolute; inset: 0; }
#rendererError { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 24px; background: rgba(8,12,16,0.94); color: #fff; text-align: center; pointer-events: auto; }
#rendererError[hidden] { display: none; }
#rendererErrorText { max-width: 520px; font-size: 18px; line-height: 1.5; }
#rendererRetry { border: 0; border-radius: 6px; padding: 10px 18px; background: #9ee868; color: #1c2e14; font-weight: 700; cursor: pointer; }

#hud { position: absolute; inset: 0; pointer-events: none; user-select: none; }

/* ---- 准星 ---- */
#crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; --gap: 8px; }
.ch { position: absolute; background: #fff; box-shadow: 0 0 2px rgba(0,0,0,0.9); }
.ch-t { width: 2px; height: 9px; left: -1px; top: calc(-1 * var(--gap) - 9px); }
.ch-b { width: 2px; height: 9px; left: -1px; top: var(--gap); }
.ch-l { width: 9px; height: 2px; top: -1px; left: calc(-1 * var(--gap) - 9px); }
.ch-r { width: 9px; height: 2px; top: -1px; left: var(--gap); }
.ch-dot { position: absolute; width: 3px; height: 3px; left: -1.5px; top: -1.5px; background: #fff; border-radius: 50%; }

/* ---- 命中标记 ---- */
#hitmarker { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; transform: translate(-50%,-50%); opacity: 0; transition: transform 0.08s; }
#hitmarker span { position: absolute; width: 10px; height: 2px; background: #fff; box-shadow: 0 0 3px #000; }
#hitmarker span:nth-child(1) { transform: rotate(45deg); left: -2px; top: 1px; }
#hitmarker span:nth-child(2) { transform: rotate(-45deg); right: -2px; top: 1px; }
#hitmarker span:nth-child(3) { transform: rotate(-45deg); left: -2px; bottom: 1px; }
#hitmarker span:nth-child(4) { transform: rotate(45deg); right: -2px; bottom: 1px; }

/* ---- 顶部比分 ---- */
#topbar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 14px; align-items: center; }
.score { display: flex; gap: 10px; align-items: center; background: rgba(0,0,0,0.45); padding: 6px 16px; border-radius: 8px; font-size: 22px; font-weight: bold; color: #fff; }
.score .tname { font-size: 13px; opacity: 0.85; }
.score.red span#scoreRed { color: #ff7b6e; }
.score.blue span#scoreBlue { color: #6db4ff; }
.mode { font-size: 14px; color: rgba(255,255,255,0.85); text-shadow: 0 1px 3px #000; }

/* ---- 血量 ---- */
#healthWrap { position: absolute; left: 26px; bottom: 26px; display: flex; align-items: center; gap: 12px; }
#healthBarWrap { width: 210px; height: 14px; background: rgba(0,0,0,0.5); border-radius: 7px; overflow: hidden; }
#healthBar { height: 100%; width: 100%; background: #7ecb5f; transition: width 0.15s; }
#health { font-size: 26px; font-weight: bold; color: #fff; text-shadow: 0 1px 4px #000; min-width: 48px; }

/* ---- 武器信息 ---- */
#ammoWrap { position: absolute; right: 30px; bottom: 22px; text-align: right; color: #fff; text-shadow: 0 1px 4px #000; }
#weaponName { font-size: 14px; opacity: 0.8; letter-spacing: 2px; }
#ammo { font-size: 40px; font-weight: bold; }
#ammoReserve { font-size: 20px; opacity: 0.75; }
#reloadTip { display: none; font-size: 14px; color: #ffd062; margin-top: 2px; animation: blink 0.9s infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

/* ---- 击杀播报 ---- */
#killfeed { position: absolute; top: 130px; left: 18px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.kf-item { background: rgba(0,0,0,0.55); padding: 5px 12px; border-radius: 6px; font-size: 14px; color: #eee; transition: opacity 0.5s; }
.kf-item .red { color: #ff7b6e; font-weight: bold; }
.kf-item .blue { color: #6db4ff; font-weight: bold; }
.kf-icon { margin: 0 8px; }

/* ---- 计分板 ---- */
#scoreboard { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); background: rgba(10,14,20,0.88); border-radius: 10px; padding: 18px 26px; color: #fff; min-width: 380px; display: none; }
.sb-row { display: grid; grid-template-columns: 1.6fr 0.8fr 0.5fr 0.5fr; gap: 8px; padding: 6px 4px; font-size: 15px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sb-head { opacity: 0.6; font-size: 12px; }
.sb-me { background: rgba(255,255,255,0.08); border-radius: 4px; }
.sb-row .red { color: #ff7b6e; } .sb-row .blue { color: #6db4ff; }

/* ---- 受击 ---- */
#vignette { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, transparent 55%, rgba(200,20,10,0.55) 100%); }

/* ---- 重生 ---- */
#respawnOverlay { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; background: rgba(60,0,0,0.35); }
.resp-title { font-size: 34px; color: #ffd3cd; font-weight: bold; text-shadow: 0 2px 8px #000; }
.resp-timer { font-size: 20px; color: #fff; margin-top: 12px; text-shadow: 0 1px 4px #000; }
#respawnTimer { font-size: 30px; font-weight: bold; }

#captchaBox { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px; background: rgba(10,14,20,0.82); border: 1px solid rgba(158,232,104,0.45); border-radius: 6px; color: #fff; }
#captchaBox[hidden] { display: none; }
#captchaQuestion { font-weight: 700; white-space: nowrap; }
#captchaAnswer { width: 86px; padding: 8px; border: 1px solid rgba(255,255,255,0.25); border-radius: 4px; background: rgba(0,0,0,0.35); color: #fff; font: inherit; }
#captchaSubmit, #captchaCancel { border: 0; border-radius: 4px; padding: 8px 10px; cursor: pointer; font-weight: 700; }
#captchaSubmit { background: #9ee868; color: #1c2e14; }
#captchaCancel { background: rgba(255,255,255,0.14); color: #fff; }
#fsBtn { position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 8px;
  background: rgba(0,0,0,0.45); color: #fff; font-size: 22px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; pointer-events: auto; user-select: none; }
#fsBtn:hover { background: rgba(255,255,255,0.18); }
#teamRoster { position: absolute; top: 58px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 18px; font-size: 12px; color: rgba(255,255,255,0.8); text-shadow: 0 1px 2px #000; }
.tr-col { background: rgba(0,0,0,0.35); border-radius: 6px; padding: 5px 10px; min-width: 110px; max-height: 120px; overflow: hidden; }
.tr-title { font-weight: bold; margin-bottom: 3px; }
.red-t { color: #ff7b6e; } .blue-t { color: #6db4ff; }

#centerMsg { position: absolute; top: 30%; left: 50%; transform: translate(-50%,-50%);
  font-size: 34px; font-weight: 900; color: #ffd062; text-shadow: 0 2px 8px #000, 0 0 20px rgba(0,0,0,0.6);
  opacity: 0; transition: opacity 0.3s; white-space: nowrap; }

#pausePanel { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  background: rgba(10,14,20,0.92); border-radius: 12px; padding: 26px 34px; color: #fff;
  display: flex; flex-direction: column; gap: 14px; min-width: 300px; pointer-events: auto; }
.pp-title { font-size: 24px; font-weight: bold; text-align: center; }
.pp-btn { padding: 10px; font-size: 16px; border: none; border-radius: 6px; cursor: pointer; background: #9ee868; color: #1c2e14; font-weight: bold; }
.pp-btn.small { padding: 4px 12px; font-size: 13px; }
.pp-btn.main { background: #9ee868; }
.pp-btn.menu { background: rgba(255,255,255,0.12); color: #ff9d92; font-weight: normal; }
.pp-btn.menu:hover { background: rgba(255,120,100,0.25); }
.pp-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 14px; color: rgba(255,255,255,0.85); }
.pp-row input[type=range] { width: 150px; }

/* 菜单选队 */
#keybinds { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: rgba(255,255,255,0.55); text-shadow: 0 1px 2px #000; white-space: nowrap; }
#keybinds b { color: rgba(255,255,255,0.85); }
#hint { position: absolute; bottom: 15%; left: 50%; transform: translateX(-50%); font-size: 16px; color: rgba(255,255,255,0.92); text-shadow: 0 1px 4px #000; }

/* ---- 主菜单 v2: 实战风格, 背景透出 3D 战场 ---- */
#menu { position: absolute; inset: 0; display: flex;
  background: linear-gradient(95deg, rgba(5,9,7,0.96) 0%, rgba(5,9,7,0.86) 30%, rgba(5,9,7,0.42) 60%, rgba(5,9,7,0.06) 88%);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif; }

.menu-left { width: 470px; min-width: 430px; height: 100%; box-sizing: border-box;
  padding: 40px 42px 20px 50px; display: flex; flex-direction: column; overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(7,11,8,0.72), rgba(7,11,8,0.42));
  backdrop-filter: blur(6px); }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.brand-frog { font-size: 34px; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6)); }
.brand-tag { font-size: 15px; font-weight: 800; letter-spacing: 4px; color: #e8f5dc; }
.brand-sub { font-size: 11px; letter-spacing: 1px; color: rgba(255,255,255,0.45); margin-top: 2px; }

.menu-title { margin: 0 0 6px -5px; font-size: 74px; font-weight: 900; font-style: italic;
  letter-spacing: 2px; color: #f2f7ee; line-height: 0.95; white-space: nowrap;
  text-shadow: 4px 4px 0 #1e4d2b, 8px 8px 0 rgba(0,0,0,0.35); }
.menu-title span { color: #a3e635; }
.title-bar { height: 6px; width: 130px; margin: 16px 0 28px; transform: skewX(-24deg);
  background: linear-gradient(90deg, #e05545 0 50%, #3e8ee0 50% 100%); }

.sec-label { font-size: 11px; letter-spacing: 3px; color: rgba(255,255,255,0.38); margin: 15px 0 8px; }
#nameInput { width: 100%; box-sizing: border-box; padding: 11px 14px; font-size: 17px; color: #fff;
  background: rgba(255,255,255,0.06); border: none; border-left: 3px solid #a3e635; outline: none; }
#nameInput:focus { background: rgba(255,255,255,0.1); }
#nameInput::placeholder { color: rgba(255,255,255,0.3); }

#modePick { display: flex; gap: 8px; }
#botOpts { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.opt-label { font-size: 12px; color: rgba(255,255,255,0.4); }
.mode-btn, .diff-btn, .cnt-btn { padding: 9px 14px; font-size: 14px; color: rgba(255,255,255,0.72);
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.14); cursor: pointer;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); transition: all 0.12s; }
.mode-btn:hover, .diff-btn:hover, .cnt-btn:hover { color: #fff; border-color: rgba(255,255,255,0.4); }
.mode-btn.sel { color: #0e1a08; font-weight: 700; background: #a3e635; border-color: #a3e635; }
.diff-btn.sel, .cnt-btn.sel { color: #a3e635; border-color: #a3e635; background: rgba(163,230,53,0.1); }

#teamPick { display: flex; gap: 8px; }
.tp-btn { padding: 9px 14px; font-size: 14px; color: rgba(255,255,255,0.72);
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.14); cursor: pointer;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); transition: all 0.12s; }
.tp-btn:hover { color: #fff; border-color: rgba(255,255,255,0.4); }
.tp-btn.sel { color: #a3e635; border-color: #a3e635; background: rgba(163,230,53,0.1); }
.tp-btn.red.sel { color: #ff8a7d; border-color: #e05545; background: rgba(224,85,69,0.12); }
.tp-btn.blue.sel { color: #8cc2ff; border-color: #3e8ee0; background: rgba(62,142,224,0.12); }

#menuRoster { display: flex; gap: 8px; margin-top: 8px; }
.mr-col { flex: 1; background: rgba(255,255,255,0.04); padding: 8px 10px; font-size: 12px;
  max-height: 96px; overflow: hidden; box-sizing: border-box; }
.mr-col.red { border-top: 2px solid #e05545; } .mr-col.blue { border-top: 2px solid #3e8ee0; }
.mr-title { font-weight: 700; margin-bottom: 4px; }
.mr-col.red .mr-title { color: #ff8a7d; } .mr-col.blue .mr-title { color: #8cc2ff; }
.mr-col div div { color: rgba(255,255,255,0.7); line-height: 1.6; }

#playBtn { margin-top: 22px; padding: 15px; font-size: 19px; font-weight: 900; letter-spacing: 6px;
  cursor: pointer; color: #101a08; background: linear-gradient(100deg, #a3e635, #7bc943); border: none;
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
  transition: transform 0.12s, filter 0.12s; }
#playBtn:hover { filter: brightness(1.12); transform: translateY(-1px); }
#playBtn:disabled { opacity: 0.55; cursor: wait; }
#menuStatus { min-height: 18px; margin-top: 10px; font-size: 13px; color: #ffb54d; }

/* 右下: 作战简报 */
.briefing { position: absolute; right: 36px; bottom: 92px; width: 410px; box-sizing: border-box;
  background: linear-gradient(160deg, rgba(7,11,8,0.85), rgba(7,11,8,0.62));
  border: 1px solid rgba(255,255,255,0.09); border-left: 3px solid #a3e635;
  padding: 16px 20px 12px; backdrop-filter: blur(4px); }
.b-head { font-size: 15px; font-weight: 800; color: #e8f5dc; letter-spacing: 2px; margin-bottom: 10px; }
.b-head span { font-size: 10px; color: rgba(255,255,255,0.35); letter-spacing: 3px; }
.b-item { display: flex; gap: 10px; margin: 8px 0; font-size: 12.5px; line-height: 1.55; color: rgba(255,255,255,0.82); }
.b-item b { color: #fff; }
.b-ico { flex: 0 0 22px; font-size: 15px; }

.menu-bottom { position: absolute; bottom: 0; left: 0; right: 0; padding: 10px 36px;
  display: flex; gap: 20px; flex-wrap: wrap; font-size: 12px; color: rgba(255,255,255,0.42);
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.55)); box-sizing: border-box; }

/* ---- 移动端加载与方向 ---- */
#mobileLoading, #portraitGuard { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; padding: 24px; background: rgba(5,9,7,0.96); color: #f2f7ee; text-align: center; }
#mobileLoading[hidden], #portraitGuard[hidden] { display: none; }
.mobile-loading-title, .portrait-title { font-size: 22px; font-weight: 800; }
.mobile-loading-track { width: min(330px, 80vw); height: 8px; overflow: hidden; background: rgba(255,255,255,0.14); }
#mobileLoadingBar { width: 12%; height: 100%; background: #a3e635; transition: width 0.2s ease; }
#mobileLoadingText, .portrait-text { color: rgba(255,255,255,0.68); font-size: 14px; }
.portrait-icon { font-size: 42px; color: #a3e635; transform: rotate(-45deg); }
body.is-mobile.portrait-lock #game, body.is-mobile.portrait-lock #hud,
body.is-mobile.portrait-lock #mobileLook, body.is-mobile.portrait-lock #mobileControls { visibility: hidden; }

/* ---- 移动端触控层 ---- */
#mobileLook, #mobileControls { display: none; }
body.is-mobile #mobileLook.active { display: block; position: fixed; inset: 0; z-index: 20;
  pointer-events: auto; touch-action: none; }
body.is-mobile #mobileControls.active { display: block; position: fixed; inset: 0; z-index: 30;
  pointer-events: none; user-select: none; }
#mobileJoystick { position: absolute; left: max(22px, env(safe-area-inset-left));
  bottom: max(22px, env(safe-area-inset-bottom)); width: 142px; height: 142px;
  border: 1px solid rgba(255,255,255,0.25); border-radius: 50%; background: rgba(8,14,10,0.28);
  box-shadow: inset 0 0 0 12px rgba(255,255,255,0.035), 0 4px 18px rgba(0,0,0,0.22);
  pointer-events: auto; touch-action: none; }
.joystick-ring { position: absolute; inset: 27px; border: 1px dashed rgba(163,230,53,0.4); border-radius: 50%; }
.joystick-knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px;
  margin: -28px 0 0 -28px; border: 2px solid rgba(208,245,151,0.8); border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(210,250,155,0.68), rgba(89,133,42,0.78));
  box-shadow: 0 3px 12px rgba(0,0,0,0.4); will-change: transform; }
#mobileActions { position: absolute; right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom)); width: 220px; height: 240px; pointer-events: none; }
.mobile-action { position: absolute; width: 58px; height: 58px; padding: 0; border: 1px solid rgba(255,255,255,0.28);
  border-radius: 50%; color: #f5faef; background: rgba(8,14,10,0.58); font: 700 13px "Microsoft YaHei", sans-serif;
  text-shadow: 0 1px 3px #000; box-shadow: 0 4px 14px rgba(0,0,0,0.26); pointer-events: auto;
  touch-action: none; -webkit-tap-highlight-color: transparent; }
.mobile-action:active, .mobile-action.pressed { transform: scale(0.94); background: rgba(163,230,53,0.78); color: #14220d; text-shadow: none; }
.mobile-action.active { border-color: #a3e635; color: #a3e635; background: rgba(42,72,25,0.72); }
.action-fire { right: 0; bottom: 0; width: 86px; height: 86px; border: 2px solid rgba(255,210,112,0.75);
  background: rgba(110,55,24,0.58); color: #ffd270; font-size: 16px; }
.action-fire.pressed { background: rgba(224,85,69,0.86); color: #fff; }
.action-jump { right: 22px; bottom: 104px; }
.action-ads { right: 98px; bottom: 92px; }
.action-reload { right: 115px; bottom: 18px; }
.action-slide { right: 174px; bottom: 78px; }
.action-switch { right: 96px; bottom: 170px; }

body.is-mobile #keybinds, body.is-mobile #teamRoster { display: none; }
body.is-mobile #centerMsg { width: 90%; font-size: 25px; white-space: normal; text-align: center; }
body.is-mobile #healthWrap { left: 18px; bottom: 18px; gap: 8px; }
body.is-mobile #healthBarWrap { width: 132px; height: 11px; }
body.is-mobile #health { font-size: 22px; min-width: 38px; }
body.is-mobile #ammoWrap { right: 18px; bottom: 18px; }
body.is-mobile #ammo { font-size: 31px; }
body.is-mobile #ammoReserve { font-size: 16px; }
body.is-mobile #pausePanel { width: calc(100% - 36px); min-width: 0; padding: 22px 20px; }

/* 手机菜单采用单列, 桌面菜单规则不受影响 */
body.is-mobile #menu { display: block; overflow-y: auto; background: rgba(5,9,7,0.95); }
body.is-mobile .menu-left { width: auto; min-width: 0; height: auto; min-height: 100%; padding: 26px 22px 26px; border-right: 0; }
body.is-mobile .menu-title { font-size: 56px; }
body.is-mobile #modePick, body.is-mobile #teamPick { flex-wrap: wrap; }
body.is-mobile .mode-btn, body.is-mobile .tp-btn { flex: 1 1 130px; }
body.is-mobile .briefing { position: static; width: auto; margin: -4px 22px 28px; padding: 14px 16px 10px; }
body.is-mobile .menu-bottom { display: none; }

@media (orientation: portrait) and (max-width: 900px) {
  body.is-mobile #portraitGuard:not([hidden]) { display: flex; }
}

@media (max-width: 480px) {
  body.is-mobile #mobileJoystick { width: 118px; height: 118px; left: max(16px, env(safe-area-inset-left));
    bottom: max(16px, env(safe-area-inset-bottom)); }
  body.is-mobile .joystick-ring { inset: 23px; }
  body.is-mobile .joystick-knob { width: 48px; height: 48px; margin: -24px 0 0 -24px; }
  body.is-mobile #mobileActions { width: 176px; height: 216px; right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom)); }
  body.is-mobile .mobile-action { width: 50px; height: 50px; font-size: 12px; }
  body.is-mobile .action-fire { width: 72px; height: 72px; font-size: 14px; }
  body.is-mobile .action-jump { right: 10px; bottom: 92px; }
  body.is-mobile .action-ads { right: 76px; bottom: 82px; }
  body.is-mobile .action-reload { right: 88px; bottom: 12px; }
  body.is-mobile .action-slide { right: 136px; bottom: 68px; }
  body.is-mobile .action-switch { right: 75px; bottom: 158px; }
}

/* 人机验证 (图片验证码 + PoW) */
#captchaImage { height: 46px; border-radius: 4px; display: block; user-select: none; }
#captchaAnswer { width: 110px; text-transform: uppercase; letter-spacing: 2px; }
#captchaRefresh { background: rgba(255,255,255,0.08); color: #cfd8dc; border: 1px solid rgba(255,255,255,0.2); border-radius: 4px; padding: 8px; cursor: pointer; }
#hpField { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; opacity: 0; }

/* 配件槽 + 射击模式 */
#fireMode { font-size: 11px; color: #9ee868; border: 1px solid rgba(158,232,104,0.5); border-radius: 3px; padding: 1px 5px; margin-left: 6px; vertical-align: middle; }
#fireMode.semi { color: #ffce4f; border-color: rgba(255,206,79,0.55); }
#attachRow { display: flex; gap: 5px; margin-top: 3px; }
.att-slot { font-size: 10px; padding: 2px 6px; border-radius: 3px; border: 1px solid rgba(255,255,255,0.15); color: rgba(255,255,255,0.28); background: rgba(0,0,0,0.3); letter-spacing: 1px; }
.att-slot.on { color: #1c2e14; background: #ffce4f; border-color: #ffce4f; font-weight: 700; }
#ppReloadAssets { opacity: 0.75; }
