* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0b0e14; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: #e6edf3; }
#game { display: block; width: 100vw; height: 100vh; cursor: crosshair; }

.overlay {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 30%, rgba(88,166,255,.18), rgba(11,14,20,.96));
  backdrop-filter: blur(4px);
}
.overlay.hidden { display: none; }
.hidden { display: none !important; }
.panel {
  width: min(420px, 88vw); padding: 32px 28px; border-radius: 16px;
  background: rgba(22,27,34,.92); border: 1px solid rgba(88,166,255,.35);
  box-shadow: 0 20px 60px rgba(0,0,0,.5); text-align: center;
  max-height: 94vh; overflow-y: auto;
}
.panel.wide { width: min(460px, 94vw); padding: 20px 16px 16px; }
.panel h1 { font-size: 34px; letter-spacing: 4px; background: linear-gradient(90deg,#58a6ff,#bc8cff,#ff7b72); -webkit-background-clip: text; background-clip: text; color: transparent; }
.panel h2 { font-size: 26px; margin-bottom: 14px; color: #ffa657; }
.sub { color: #8b949e; margin: 8px 0 22px; font-size: 13px; }
input {
  width: 100%; padding: 12px 14px; border-radius: 10px; margin-bottom: 14px;
  border: 1px solid #30363d; background: #0d1117; color: #e6edf3; font-size: 15px; outline: none;
}
input:focus { border-color: #58a6ff; }
button {
  width: 100%; padding: 13px; border: none; border-radius: 10px; cursor: pointer;
  font-size: 16px; font-weight: 600; color: #fff;
  background: linear-gradient(90deg,#1f6feb,#8957e5); transition: transform .08s;
}
button:active { transform: scale(.98); }
.hint { color: #8b949e; font-size: 12px; line-height: 1.6; margin-top: 16px; }
.link-btn { color: #58a6ff; cursor: pointer; text-decoration: underline; font-weight: 600; }

.coin-line { font-size: 13px; margin: 6px 0 10px; color: #f2cc60; display: flex; align-items: center; justify-content: center; gap: 6px; }
.shop-title { font-size: 13px; font-weight: 600; color: #8b949e; text-align: left; margin: 4px 0 6px; }
.owned { color: #8b949e; font-size: 12px; }
.shop-list { max-height: 168px; overflow: auto; display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.shop-list.tall { max-height: 320px; }
.shop-item { display: flex; align-items: center; gap: 10px; background: rgba(13,17,23,.7); border: 1px solid #30363d; border-radius: 10px; padding: 8px 10px; text-align: left; }
.shop-item .si-icon { font-size: 22px; width: 30px; text-align: center; }
.skin-swatch { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; border: 1px solid rgba(255,255,255,.25); }
.shop-item .si-info { flex: 1; min-width: 0; }
.shop-item .si-name { font-size: 13px; font-weight: 600; color: #e6edf3; }
.shop-item .si-desc { font-size: 11px; color: #8b949e; margin-top: 2px; }
.shop-item .si-have { font-size: 11px; color: #58a6ff; }
.shop-item .si-buy { width: auto; padding: 6px 12px; font-size: 12px; background: linear-gradient(90deg,#1f6feb,#8957e5); color: #fff; }
.shop-item .si-buy:disabled { background: linear-gradient(90deg,#238636,#2ea043); color: #fff; cursor: not-allowed; }
.coin-tag { color: #f2cc60; }
.panel button.ghost-btn { background: #21262d; border: 1px solid #30363d; margin-top: 10px; }

/* ---------- 主界面 App 布局 + 底部导航 ---------- */
.app { position: absolute; inset: 0; display: flex; flex-direction: column; background: rgba(11,14,20,.88); }
.app.hidden { display: none; }
.app-head { padding: 20px 16px 6px; text-align: center; flex-shrink: 0; }
.app-head h1 { font-size: 28px; letter-spacing: 3px; background: linear-gradient(90deg,#58a6ff,#bc8cff,#ff7b72); -webkit-background-clip: text; background-clip: text; color: transparent; }
.app-body { flex: 1; overflow-y: auto; padding: 6px 16px 96px; }
.app-nav {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; gap: 4px; padding: 6px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(22,27,34,.97); border-top: 1px solid #30363d;
  box-shadow: 0 -6px 24px rgba(0,0,0,.35);
}
.app-nav .mtab {
  flex: 1; padding: 8px 0 6px; border-radius: 12px; background: transparent;
  border: none; font-size: 11px; color: #8b949e; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.app-nav .mtab .nav-icon { font-size: 20px; line-height: 1; }
.app-nav .mtab.active { background: linear-gradient(180deg, rgba(31,111,235,.25), rgba(137,87,229,.15)); color: #fff; font-weight: 600; box-shadow: inset 0 0 0 1px rgba(88,166,255,.35); }
.mtab-page.hidden { display: none; }
.sec { font-size: 13px; font-weight: 700; color: #c9d1d9; text-align: left; margin: 12px 0 6px; }
.sec-sub { font-size: 11px; color: #8b949e; font-weight: 400; }
.map-cards { display: flex; gap: 8px; flex-wrap: wrap; }
.map-card { flex: 1; min-width: 96px; padding: 10px 6px; border-radius: 10px; border: 2px solid #30363d; background: #0d1117; cursor: pointer; text-align: center; }
.map-card .mc-color { width: 100%; height: 34px; border-radius: 8px; margin-bottom: 6px; border: 1px solid rgba(255,255,255,.15); }
.map-card .mc-name { font-size: 12px; color: #e6edf3; }
.map-card.selected { border-color: #58a6ff; box-shadow: 0 0 12px rgba(88,166,255,.4); }
.mode-cards { display: flex; gap: 8px; flex-wrap: wrap; }
.mode-card { flex: 1; min-width: 72px; padding: 10px 6px; border-radius: 10px; border: 2px solid #30363d; background: #0d1117; cursor: pointer; text-align: center; }
.mode-card .mc-name { font-size: 12px; font-weight: 600; color: #e6edf3; }
.mode-card .mc-fee { font-size: 11px; color: #f2cc60; margin-top: 3px; }
.mode-card.selected { border-color: #f2cc60; box-shadow: 0 0 12px rgba(242,204,96,.4); }
.mode-card.danger.selected { border-color: #ff7b72; box-shadow: 0 0 12px rgba(255,123,114,.4); }
.carry-list { display: flex; flex-direction: column; gap: 6px; }
.carry-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid #30363d; background: #0d1117; cursor: pointer; }
.carry-item .ci-box { width: 18px; height: 18px; border-radius: 5px; border: 2px solid #8b949e; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.carry-item.checked .ci-box { background: #1f6feb; border-color: #1f6feb; color: #fff; }
.carry-item .ci-name { font-size: 13px; color: #e6edf3; flex: 1; text-align: left; }
.carry-item .ci-have { font-size: 11px; color: #58a6ff; }
.carry-item.locked { opacity: .5; pointer-events: none; }
.sub-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.stab { flex: 1; padding: 8px 0; border-radius: 8px; background: rgba(88,166,255,.3); border: 1px solid #58a6ff; color: #fff; font-size: 13px; }
.stab.active { background: #1f6feb; color: #fff; font-weight: 600; border-color: transparent; }
.avatar-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.avatar-cell { font-size: 22px; padding: 6px 0; border-radius: 8px; border: 2px solid #30363d; background: #0d1117; cursor: pointer; text-align: center; }
.avatar-cell.selected { border-color: #58a6ff; box-shadow: 0 0 10px rgba(88,166,255,.4); }
.skin-my-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; }
.skin-my { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; border: 1px solid #30363d; background: #0d1117; }
.skin-my .si-info { flex: 1; text-align: left; }
.skin-my .si-buy { width: auto; padding: 5px 12px; font-size: 12px; }

.lobby {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; background: rgba(11,14,20,.97); padding: 24px;
}
.lobby-icon { font-size: 44px; margin-bottom: 8px; animation: lobbyPulse 1.2s ease-in-out infinite; }
.lobby-title { font-size: 20px; font-weight: 700; color: #e6edf3; margin-bottom: 12px; }
.lobby-mode { font-size: 13px; color: #f2cc60; margin-bottom: 8px; }
.lobby-info { font-size: 15px; color: #8b949e; margin-bottom: 6px; }
.lobby-info b { color: #ffa657; font-size: 20px; }
.lobby-timer { font-size: 14px; color: #c9d1d9; margin-bottom: 4px; }
.lobby-timer b { color: #58a6ff; font-size: 22px; }
@keyframes lobbyPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }

.hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.hud.hidden { display: none; }
.hud-top { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; }
.tag { padding: 6px 12px; border-radius: 20px; font-size: 13px; background: rgba(22,27,34,.85); border: 1px solid #30363d; }
#phaseTag { color: #7ee787; }
.sound-btn {
  padding: 6px 12px; border-radius: 20px; font-size: 13px;
  background: rgba(22,27,34,.85); border: 1px solid #30363d;
  color: #fff; cursor: pointer; line-height: 1.2;
}
.sound-btn:active { transform: scale(.94); }
.timer { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; padding: 4px 14px; border-radius: 10px; background: rgba(22,27,34,.85); border: 1px solid #30363d; }
.hud-stats { position: absolute; left: 14px; bottom: 14px; width: 240px; display: flex; flex-direction: column; gap: 8px; }
.bar { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bar span { width: 24px; color: #8b949e; }
.bar-bg { flex: 1; height: 12px; border-radius: 8px; background: #161b22; border: 1px solid #30363d; overflow: hidden; }
.bar-fill { height: 100%; transition: width .12s linear; }
.bar-fill.hp { background: linear-gradient(90deg,#3fb950,#7ee787); }
.stat { display: flex; justify-content: space-between; font-size: 13px; background: rgba(22,27,34,.8); padding: 6px 10px; border-radius: 8px; border: 1px solid #30363d; }
.stat b { color: #58a6ff; }
.board { position: absolute; right: 14px; top: 14px; width: 200px; background: rgba(22,27,34,.82); border: 1px solid #30363d; border-radius: 10px; padding: 10px; font-size: 12px; }
.board h3 { font-size: 13px; color: #8b949e; margin-bottom: 6px; font-weight: 600; }
.board .row { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid rgba(48,54,61,.5); }
.board .row.me { color: #ffa657; font-weight: 700; }
.board .row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
#finalRank { font-size: 13px; text-align: left; max-height: 260px; overflow: auto; }
#finalRank .fr { display: flex; justify-content: space-between; padding: 4px 2px; border-bottom: 1px solid rgba(48,54,61,.5); }
#finalRank .fr.me { color: #ffa657; font-weight: 700; }

.skill-btn {
  position: absolute; right: 20px; bottom: 20px;
  width: 74px; height: 74px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(88,166,255,.5), rgba(31,111,235,.85));
  border: 2px solid rgba(255,255,255,.35);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; pointer-events: auto; user-select: none;
  box-shadow: 0 4px 20px rgba(31,111,235,.45);
  transition: transform .08s, filter .2s;
}
.skill-btn:active { transform: scale(.94); }
.skill-btn.ready { animation: skillPulse 1.6s ease-in-out infinite; }
.skill-btn.active { border-color: #56d4dd; box-shadow: 0 0 24px rgba(86,212,221,.8); }
.skill-btn.oncd { filter: grayscale(.75); opacity: .75; }
.skill-icon { font-size: 24px; line-height: 1; }
.skill-name { font-size: 11px; margin-top: 3px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.skill-cd {
  position: absolute; inset: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(13,17,23,.72); color: #e6edf3; font-size: 15px; font-weight: 700;
}
.death-hint { display: none; }

/* ---------- 战绩 / 玩家主页 ---------- */
.my-stats {
  display: flex; gap: 10px; justify-content: center;
  background: rgba(13,17,23,.7); border: 1px solid #30363d; border-radius: 10px;
  padding: 10px; font-size: 13px; color: #c9d1d9;
}
.my-stats b { color: #58a6ff; font-size: 16px; }
.my-stats .wr b { color: #ffa657; }
.my-avatar-box {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: rgba(13,17,23,.7); border: 1px solid #30363d; border-radius: 10px;
  padding: 12px; font-size: 13px; color: #8b949e;
}
.my-avatar-box .av-cur { font-size: 46px; line-height: 1; }
.my-avatar-box .av-link { color: #58a6ff; cursor: pointer; text-decoration: underline; }
.avatar-shop-emoji { font-size: 24px; width: 40px; text-align: center; flex-shrink: 0; }
.profile-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(11,14,20,.72); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
}
.profile-card {
  position: relative; width: min(340px, 90vw); max-height: 84vh; overflow-y: auto;
  background: #161b22; border: 1px solid #30363d; border-radius: 16px;
  padding: 26px 22px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.profile-close {
  position: absolute; top: 10px; right: 12px; background: none; border: none;
  color: #8b949e; font-size: 18px; cursor: pointer; padding: 6px;
}
.profile-close:hover { color: #f85149; }
.profile-avatar { font-size: 52px; line-height: 1; margin-bottom: 6px; }
.profile-name { font-size: 20px; font-weight: 700; color: #e6edf3; margin-bottom: 8px; }
.profile-stats {
  display: flex; justify-content: center; gap: 16px; font-size: 13px; color: #8b949e;
  background: rgba(13,17,23,.6); border: 1px solid #30363d; border-radius: 10px; padding: 8px;
}
.profile-stats b { color: #ffa657; font-size: 16px; }
.profile-sec { font-size: 13px; font-weight: 600; color: #8b949e; text-align: left; margin: 14px 0 8px; }
.profile-skins { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.profile-skins .p-skin {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: #0d1117; border: 1px solid #30363d; border-radius: 10px; padding: 8px 10px;
}
.profile-skins .p-skin span { font-size: 11px; color: #c9d1d9; }
.avatar-mini { font-size: 13px; margin-right: 5px; }

/* 排行榜/结算行可点击查看主页 */
.board .row, #finalRank .fr { cursor: pointer; }
.board .row:hover, #finalRank .fr:hover { background: rgba(88,166,255,.1); }

/* 结算奖励 / 金币记录 */
.final-reward {
  margin: 6px auto 10px; padding: 8px 12px; border-radius: 10px; font-size: 13px;
  background: rgba(242,204,96,.12); border: 1px solid rgba(242,204,96,.45); color: #f2cc60;
  display: inline-block;
}
.final-reward.none { background: rgba(139,148,158,.12); border-color: #30363d; color: #8b949e; }
.ledger-list { max-height: 300px; overflow-y: auto; text-align: left; font-size: 13px; }
.ledger-list .lg { display: flex; justify-content: space-between; align-items: center; padding: 6px 4px; border-bottom: 1px solid rgba(48,54,61,.5); }
.ledger-list .lg .lg-why { color: #c9d1d9; flex: 1; text-align: left; }
.ledger-list .lg .lg-amt { font-weight: 700; margin: 0 8px; }
.ledger-list .lg .lg-amt.in { color: #3fb950; }
.ledger-list .lg .lg-amt.out { color: #f85149; }
.ledger-list .lg .lg-t { color: #8b949e; font-size: 11px; }

/* ---------- 战斗聊天（左侧独立面板，快捷语句） ---------- */
.chat-panel {
  position: fixed; left: 14px; bottom: 110px; width: 240px;
  background: rgba(13,17,23,.86); border: 1px solid rgba(48,54,61,.8); border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden; z-index: 30;
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
  pointer-events: auto;
}
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 7px 12px; font-size: 12px; color: #8b949e; font-weight: 600; background: rgba(22,27,34,.9); border-bottom: 1px solid rgba(48,54,61,.6); cursor: pointer; user-select: none; }
.chat-actions { display: flex; align-items: center; gap: 8px; }
.chat-toggle { font-size: 13px; color: #58a6ff; cursor: pointer; padding: 2px 4px; border-radius: 5px; }
.chat-toggle:hover { background: rgba(88,166,255,.15); }
.chat-toggle.chat-close { color: #f85149; }
.chat-toggle.chat-close:hover { background: rgba(248,81,73,.15); }

/* 全局聊天（主界面）：居中，默认只显示 2 条最新，可展开全部 */
#globalChat {
  left: 50%; right: auto; transform: translateX(-50%);
  width: min(420px, 92vw); bottom: 122px;
}
#globalChat .chat-body { height: 56px; overflow: hidden; transition: height .18s ease; }
#globalChat.expanded .chat-body { height: 200px; overflow-y: auto; }
#globalChatOpenBtn { left: 50%; right: auto; transform: translateX(-50%); bottom: 122px; }
.chat-body {
  height: 150px; overflow-y: auto; padding: 8px 10px;
  display: flex; flex-direction: column; gap: 5px; font-size: 12px;
}
.chat-body .cm {
  background: rgba(22,27,34,.8); border-radius: 8px; padding: 5px 8px;
  color: #c9d1d9; word-break: break-word; line-height: 1.4;
}
.chat-body .cm .cm-from { color: #58a6ff; font-weight: 600; margin-right: 4px; }
.chat-body .cm.me .cm-from { color: #ffa657; }
.chat-quick-title {
  padding: 5px 10px 3px; font-size: 11px; color: #8b949e;
  border-top: 1px solid rgba(48,54,61,.6); flex-shrink: 0;
}
.quick-chats {
  display: flex; flex-direction: column; gap: 4px; padding: 4px 6px 6px;
  overflow-y: auto; max-height: 190px; flex-shrink: 0;
}
.quick-chats::-webkit-scrollbar { width: 4px; }
.quick-chats::-webkit-scrollbar-thumb { background: #30363d; border-radius: 2px; }
.quick-chats button {
  flex-shrink: 0; padding: 7px 10px; border-radius: 8px; text-align: left;
  background: #21262d; border: 1px solid #30363d; color: #c9d1d9;
  font-size: 12px; cursor: pointer; width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.quick-chats button:active { transform: scale(.98); background: #1f6feb; color: #fff; }
.chat-input-row { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-top: 1px solid rgba(48,54,61,.6); flex-shrink: 0; }
.chat-input {
  flex: 1; min-width: 0; width: auto; height: 42px; margin: 0; border-radius: 10px;
  background: #0d1117; border: 1px solid #30363d; color: #e6edf3;
  padding: 0 12px; font-size: 15px; outline: none;
}
.chat-input:focus { border-color: #58a6ff; }
.chat-send {
  width: auto; margin: 0; height: 32px; padding: 0 12px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(90deg,#1f6feb,#8957e5); color: #fff;
  font-size: 12px; border: none; cursor: pointer;
}
.chat-send:active { transform: scale(.95); }
.chat-panel.collapsed .chat-body, .chat-panel.collapsed .quick-chats, .chat-panel.collapsed .chat-quick-title, .chat-panel.collapsed .chat-input-row { display: none; }
.chat-open {
  position: fixed; left: 14px; bottom: 110px; width: 44px; height: 44px;
  border-radius: 50%; background: rgba(31,111,235,.9); border: 1px solid rgba(255,255,255,.3);
  color: #fff; font-size: 20px; cursor: pointer; z-index: 30; box-shadow: 0 4px 16px rgba(0,0,0,.4);
  pointer-events: auto;
}
.chat-open:active { transform: scale(.94); }

.pause-banner {
  position: absolute; left: 50%; top: 14%; transform: translateX(-50%);
  padding: 10px 20px; border-radius: 12px; font-size: 15px; font-weight: 600;
  background: rgba(22,27,34,.92); border: 1px solid rgba(86,212,221,.7);
  color: #56d4dd; pointer-events: none; white-space: nowrap;
}
.pause-banner span { color: #e6edf3; }

.kill-feed {
  position: absolute; right: 14px; top: 12px;
  width: 210px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  pointer-events: none; z-index: 5;
}
.kill-feed .kf {
  background: rgba(13,17,23,.72); border: 1px solid rgba(48,54,61,.6);
  border-radius: 8px; padding: 4px 10px; font-size: 12px; color: #c9d1d9;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  animation: kfIn .18s ease-out;
}
.kill-feed .kf .k-killer { color: #ffa657; font-weight: 600; }
.kill-feed .kf .k-victim { color: #8b949e; }
.kill-feed .kf.me { border-color: rgba(255,166,87,.7); }
@keyframes kfIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.streak-banner {
  position: absolute; left: 50%; top: 32%; transform: translateX(-50%);
  pointer-events: none; z-index: 15; text-align: center;
  font-size: 42px; font-weight: 800; letter-spacing: 4px;
  background: linear-gradient(90deg, #ffd33d, #ff7b72, #bc8cff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: streakIn 1.4s ease-out forwards;
}
.streak-banner .sb-name { display: block; font-size: 16px; font-weight: 600; color: #e6edf3; letter-spacing: 2px; margin-top: 4px; text-shadow: 0 2px 8px rgba(0,0,0,.8); }
@keyframes streakIn {
  0% { transform: translateX(-50%) scale(.4); opacity: 0; }
  25% { transform: translateX(-50%) scale(1.15); opacity: 1; }
  60% { transform: translateX(-50%) scale(1); opacity: 1; }
  100% { transform: translateX(-50%) scale(1) translateY(-46px); opacity: 0; }
}

@keyframes skillPulse {
  0%,100% { box-shadow: 0 4px 20px rgba(31,111,235,.45); }
  50% { box-shadow: 0 0 30px rgba(86,212,221,.9); }
}
