/* ============ 全局 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0b1020;
  --panel: #141b31;
  --panel2: #1b2542;
  --line: #2b3a63;
  --text: #dfe7ff;
  --muted: #8a97c0;
  --accent: #ffb25e;
  --primary: #3c8dff;
  --danger: #ff5a5a;
  --green: #34d399;
  --gold: #fbbf24;
}
html, body { height: 100%; }
body {
  background: radial-gradient(1200px 700px at 70% -10%, #1b2a5e 0%, var(--bg) 60%);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  overflow: hidden;
  user-select: none;
}
.hidden { display: none !important; }

/* ============ 屏幕切换 ============ */
.screen { display: none; height: 100vh; width: 100vw; }
.screen.active { display: flex; }

/* ============ 登录 ============ */
/* 参考图作为登录页最底层背景（覆盖 + 暗色渐变保证文字可读） */
#screen-login {
  align-items: center; justify-content: center;
  position: relative;
  background:
    linear-gradient(rgba(7,10,21,.66), rgba(7,10,21,.82)),
    url('../assets/login-bg.webp') center / cover no-repeat;
}
.login-wrap { width: min(520px, 92vw); text-align: center; }
.back-home {
  display: inline-block; margin-bottom: 10px; padding: 6px 14px;
  color: var(--text); font-size: 13px; font-weight: 700; text-decoration: none;
  border: 1px solid rgba(60, 141, 255, 0.35); border-radius: 999px;
  background: rgba(60, 141, 255, 0.1); transition: all .15s;
}
.back-home:hover { border-color: var(--accent); color: var(--accent); }
.login-panel { background: linear-gradient(180deg, rgba(20,27,49,.88), rgba(27,37,66,.9)); backdrop-filter: blur(6px); }
.game-title { font-size: 42px; letter-spacing: 2px; margin-bottom: 8px; text-shadow: 0 0 30px rgba(60,141,255,.6); }
.game-title span { color: var(--accent); }
.subtitle { color: var(--muted); margin-bottom: 26px; }
.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.login-panel { text-align: left; }
.form-row { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.form-row.col { flex-direction: column; align-items: stretch; }
.form-row label { color: var(--muted); font-size: 13px; white-space: nowrap; }
input, select, textarea {
  flex: 1;
  min-width: 0;
  background: #0d1428;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(60,141,255,.25); }
textarea { resize: vertical; }
.btn {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: linear-gradient(135deg, #3c8dff, #6a5cff); border-color: transparent; }
.btn.danger { background: linear-gradient(135deg, #ff5a5a, #c93); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.block { width: 100%; }
.btn.text { background: transparent; border: none; color: var(--primary); }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.lobby-links { display: flex; justify-content: center; margin: 2px 0 12px; }
.lobby-links .btn { border-color: rgba(255, 207, 92, 0.5); color: var(--gold); }
.lobby-links .btn:hover { box-shadow: 0 0 14px rgba(255, 207, 92, 0.3); }
.join-row { display: flex; gap: 8px; margin-bottom: 14px; }
.join-row input { flex: 1; }
.divider { text-align: center; color: var(--muted); font-size: 12px; margin: 14px 0 8px; position: relative; }
.divider::before, .divider::after { content: ''; position: absolute; top: 50%; width: 30%; height: 1px; background: var(--line); }
.divider::before { left: 0; } .divider::after { right: 0; }
.room-list { max-height: 220px; overflow-y: auto; margin-bottom: 10px; }
.room-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 8px;
  background: #0d1428; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px;
}
.room-item .rid { font-weight: 700; color: var(--gold); letter-spacing: 1px; }
.room-item .rinfo { color: var(--muted); flex: 1; }
.room-item button { flex-shrink: 0; }
.empty-hint { color: var(--muted); font-size: 13px; padding: 14px; text-align: center; }
.tip { color: var(--muted); font-size: 12px; margin-top: 16px; }

/* ============ 房间 ============ */
#screen-room { flex-direction: column; }
#topbar {
  height: 52px; flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: rgba(11,16,32,.9);
  border-bottom: 1px solid var(--line);
  overflow-x: auto; flex-wrap: nowrap; /* 窄屏下顶栏按钮横向滚动，不挤压变形 */
}
.room-badge { font-size: 14px; }
.room-badge b { color: var(--gold); letter-spacing: 2px; font-size: 16px; }
.badge {
  padding: 4px 10px; border-radius: 20px; font-size: 12px;
  border: 1px solid var(--line); background: var(--panel2);
}
.status-waiting { color: var(--muted); }
.status-map { color: #a5e08a; border-color: rgba(165,224,138,.45); background: rgba(60,110,50,.18); }
.status-fighting { color: #ffd166; border-color: #ffd166; animation: pulse 1.2s infinite; }
.status-finished { color: var(--gold); border-color: var(--gold); }
.token-badge { color: #7dd3fc; }
.spacer { flex: 1; }
@keyframes pulse { 50% { opacity: .55; } }

#main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#stage-wrap {
  flex: 1; position: relative; background: #05070d; min-width: 0; min-height: 0;
  display: flex; align-items: center; justify-content: center;
}
#stage {
  width: 100%;
  height: auto;
  max-height: 100%;
  aspect-ratio: 16 / 9; /* canvas 不支持 object-fit，用 aspect-ratio + max-height 保持 16:9 不变形 */
  display: block;
}
#net-banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(255,90,90,.92); color: #fff;
  padding: 8px 18px; border-radius: 20px; font-size: 13px; z-index: 20;
}
#hud {
  display: none !important; /* 左上角角色卡已下线 */
  position: absolute; left: 14px; top: 14px; z-index: 10;
  background: rgba(10,14,28,.82); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; min-width: 220px;
}
.hud-name { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.hud-bar {
  position: relative; height: 16px; background: #0d1428;
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 4px;
}
.hud-bar.slim { height: 8px; }
.hud-bar-fill { height: 100%; transition: width .15s; }
.hud-bar-fill.hp { background: linear-gradient(90deg, #22c55e, #a3e635); }
.hud-bar-fill.hp.low { background: linear-gradient(90deg, #ef4444, #f97316); }
.hud-bar-fill.stamina { background: linear-gradient(90deg, #fbbf24, #fde047); }
.hud-bar span {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; text-shadow: 0 1px 2px #000;
}
.hud-stats, .hud-tokens { color: var(--muted); font-size: 12px; margin-top: 4px; }
.hud-tokens { color: #7dd3fc; }
#control-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  background: rgba(10,14,28,.8); border: 1px solid var(--line);
  padding: 7px 16px; border-radius: 20px; font-size: 12px; color: var(--muted); z-index: 10;
}
#control-hint b { color: var(--accent); }
#control-hint.manual { border-color: var(--gold); color: #ffe9b0; background: rgba(250,190,80,.14); box-shadow: 0 0 14px rgba(250,190,80,.25); }
.hud-buttons { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 8px; z-index: 10; }

/* ============ 底部面板（角色数值 / 战斗日志 / 弹幕聊天为主） ============ */
#bottom {
  height: 248px; flex-shrink: 0;
  background: var(--panel); border-top: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
#bottom-tools {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
}
#bottom-tools .tool-group { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 0; flex-wrap: wrap; }
#bottom-tools .tool-group input { flex: 1; min-width: 110px; padding: 6px 10px; font-size: 12px; }
#bottom-tools .tool-group select { width: 100px; padding: 6px 8px; font-size: 12px; }
#bottom-tools .tool-group .quick-ff { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); white-space: nowrap; cursor: pointer; }
#bottom-tools .tool-group .quick-ff input { flex: 0 0 auto; min-width: 0; width: 13px; height: 13px; }
#bottom-tools .tool-group .quick-gen-progress { flex: 1 1 100%; display: flex; align-items: center; gap: 8px; min-width: 0; }
#bottom-tools .tool-group .quick-gen-progress.hidden { display: none; }
#bottom-tools .tool-group .quick-gen-progress .quick-track { flex: 1; height: 8px; margin-bottom: 0; }
#bottom-tools .tool-group .quick-gen-progress .quick-gen-sub { font-size: 11px; color: var(--gold); white-space: nowrap; font-weight: 700; }

.members-box { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.members-box .section-title { white-space: nowrap; }
.members-box .member-list { flex-wrap: nowrap; overflow-x: auto; max-width: 240px; padding: 2px 0; }
#bottom-cols { flex: 1; display: grid; grid-template-columns: 1.12fr 1fr .88fr; min-height: 0; }
.bcol {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  border-right: 1px solid var(--line); padding: 8px 10px;
}
.bcol:last-child { border-right: none; }
.bcol-head { font-size: 12px; color: var(--muted); letter-spacing: 1px; margin-bottom: 6px; flex-shrink: 0; font-weight: 700; }
.section-title { font-size: 13px; color: var(--muted); letter-spacing: 1px; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 10px; line-height: 1.6; }

/* 角色数值卡片（紧凑网格） */
.bcol-chars .char-list {
  flex: 1; overflow-y: auto; min-height: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-content: start;
  padding-right: 2px;
}
.char-item {
  background: #0d1428; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px; margin-bottom: 0; font-size: 12px; min-width: 0;
}
.char-item { position: relative; }
.char-item .c-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; flex-wrap: wrap; padding-right: 84px; }
.char-item .c-auto-btn {
  position: absolute; top: 6px; right: 6px;
  font-size: 10px; padding: 3px 8px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: #101a30; color: var(--muted); white-space: nowrap;
}
.char-item .c-auto-btn.manual { color: var(--gold); border-color: var(--gold); background: rgba(250,190,80,.12); }
.char-item .c-auto-btn.dead { opacity: .4; cursor: not-allowed; }
.char-item.controllable { cursor: pointer; }
.char-item.controllable:hover { border-color: var(--gold); background: #101a30; }
.char-item .c-skills { color: #9fb4ff; font-size: 10px; margin: 0 0 5px; line-height: 1.5; }
.char-item .c-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.char-item .c-name { font-weight: 700; font-size: 13px; }
.char-item .c-title { color: var(--muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.char-item .c-tag { font-size: 10px; padding: 2px 6px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); }
.char-item .c-tag.dead { color: var(--danger); border-color: var(--danger); }
.c-hp { height: 6px; background: #0a0f1e; border-radius: 3px; overflow: hidden; margin-bottom: 3px; }
.c-hp-fill { height: 100%; background: linear-gradient(90deg, #22c55e, #a3e635); }
.c-hp-fill.low { background: linear-gradient(90deg, #ef4444, #f97316); }
.c-stamina { height: 4px; background: #0a0f1e; border-radius: 2px; overflow: hidden; margin-bottom: 4px; }
.c-stamina-fill { height: 100%; background: linear-gradient(90deg, #fbbf24, #fde047); }
.char-item .c-stats { color: var(--muted); font-size: 11px; margin: 0 0 5px; line-height: 1.5; }
.char-item .c-ops { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.char-item .c-ops select { flex: 1; min-width: 78px; padding: 4px 6px; font-size: 11px; }
.char-item .c-ops .btn { font-size: 10px; padding: 3px 8px; }

.member-list { display: flex; flex-wrap: wrap; gap: 6px; }
.member-chip { font-size: 12px; padding: 4px 10px; border-radius: 14px; background: #0d1428; border: 1px solid var(--line); color: var(--muted); }
.member-chip.me { color: var(--gold); border-color: var(--gold); }
.member-chip.offline { opacity: .45; text-decoration: line-through; }

/* 手动控制提示层（点击切换手动时弹出，6秒后淡出） */
#manual-hint {
  position: absolute; left: 50%; top: 64px; transform: translateX(-50%);
  background: rgba(10,16,34,.92); border: 1px solid var(--gold); border-radius: 12px;
  padding: 10px 18px; text-align: center; z-index: 20; pointer-events: none;
  box-shadow: 0 8px 30px rgba(0,0,0,.5); animation: manualIn .25s ease-out;
}
@keyframes manualIn { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.manual-hint-title { color: var(--gold); font-weight: 800; margin-bottom: 6px; font-size: 14px; }
.manual-hint-keys { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; color: #dfe7ff; font-size: 13px; }
.manual-hint-keys b {
  background: #1a2440; border: 1px solid #3a4a78; border-radius: 6px; padding: 2px 8px;
  color: #ffd76a; margin-right: 4px; font-size: 12px;
}
.manual-hint-tip { color: var(--muted); font-size: 11px; margin-top: 6px; }

/* 战斗日志 */
.bcol-log .log-list { flex: 1; overflow-y: auto; min-height: 0; padding-right: 2px; }
.log-list { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.log-item { padding: 5px 8px; border-left: 3px solid var(--line); background: #0d1428; border-radius: 4px; line-height: 1.5; }
.log-item.hit { border-left-color: var(--primary); }
.log-item.kill { border-left-color: var(--danger); color: #ffd0d0; }
.log-item.system { border-left-color: var(--gold); color: #ffe9b0; }
.log-item .t { color: #55618c; margin-right: 4px; }

/* 弹幕聊天对话框 */
.chat-list {
  flex: 1; overflow-y: auto; min-height: 0;
  display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px;
}
.chat-msg { font-size: 12px; line-height: 1.5; background: #0d1428; border-radius: 6px; padding: 4px 8px; word-break: break-all; }
.chat-msg .from { color: var(--gold); margin-right: 4px; }
.chat-input-row { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.chat-input-row input { flex: 1; padding: 6px 10px; font-size: 12px; }
.checkbox-row { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin: 0; cursor: pointer; white-space: nowrap; }

/* ============ 弹幕聊天 / AI智能体对话 双选项卡 ============ */
.chat-tabs { display: flex; gap: 6px; flex-shrink: 0; margin-bottom: 6px; }
.chat-tab {
  flex: 1; padding: 6px 10px; font-size: 13px; font-weight: 600;
  color: var(--muted); background: #101830; border: 1px solid var(--line);
  border-radius: 8px 8px 0 0; cursor: pointer; white-space: nowrap;
}
.chat-tab.active { color: var(--gold); background: #0d1428; border-bottom-color: transparent; }
.chat-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.agent-status-bar { display: flex; flex-wrap: wrap; gap: 4px; flex-shrink: 0; margin-bottom: 4px; max-height: 52px; overflow-y: auto; }
.agent-status-chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px;
  background: #0d1428; border: 1px solid var(--line); border-radius: 10px;
  padding: 2px 8px; color: var(--text); max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.agent-status-chip .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.agent-status-chip .dot.llm { background: #3ddc84; box-shadow: 0 0 5px #3ddc84; }
.agent-status-chip .dot.builtin { background: #f0a63c; }
.agent-status-chip .dot.fallback { background: #f05a5a; }
.agent-status-chip .dot.dead { background: #5a6478; }
.agent-status-chip .cmd-tag { color: var(--gold); font-size: 10px; }
.agent-list { flex: 1; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.agent-msg { font-size: 12px; line-height: 1.5; background: #0d1428; border-radius: 6px; padding: 4px 8px; word-break: break-all; }
.agent-msg .from { margin-right: 4px; }
.agent-msg.command { border-left: 3px solid var(--primary); }
.agent-msg.command .from { color: #7db4ff; }
.agent-msg.reply { border-left: 3px solid #3ddc84; }
.agent-msg.reply .from { color: #3ddc84; }
.agent-msg.decision { border-left: 3px solid var(--gold); color: #cbd3ea; }
.agent-msg.decision .from { color: var(--gold); }
.agent-msg.system { border-left: 3px solid var(--danger); color: #ffd0d0; }
.agent-msg.system .from { color: var(--danger); }
.agent-input-row { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.agent-input-row select { max-width: 118px; padding: 6px 6px; font-size: 12px; background: #0d1428; color: var(--text); border: 1px solid var(--line); border-radius: 6px; }
.agent-input-row input { flex: 1; padding: 6px 10px; font-size: 12px; }

/* ============ 弹窗 ============ */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4,6,14,.72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  width: min(560px, 94vw); max-height: 90vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 30px 90px rgba(0,0,0,.7);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 700;
}
.modal-close { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.modal-body { padding: 16px 18px; }

/* ============ 英雄榜弹窗（总榜/房间榜） ============ */
.board-box { width: min(640px, 94vw); }
.board-tabs { display: flex; gap: 8px; padding: 12px 16px 0; flex-wrap: wrap; }
.board-tab {
  flex: 1; min-width: 120px; padding: 9px 10px; border-radius: 10px;
  background: #0d1428; border: 1px solid var(--line); color: var(--muted);
  font-size: 13px; font-weight: 700; cursor: pointer; transition: all .15s;
}
.board-tab:hover { color: #fff; border-color: #3c8dff; }
.board-tab.active {
  color: #0b1020; border-color: transparent;
  background: linear-gradient(135deg, var(--gold), #ffb347);
  box-shadow: 0 0 16px rgba(255, 207, 92, 0.35);
}
.board-body { max-height: 46vh; overflow-y: auto; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.board-row {
  position: relative; display: grid; grid-template-columns: 44px 1fr auto; gap: 4px 10px;
  align-items: center; padding: 10px 12px;
  background: #0d1428; border: 1px solid var(--line); border-radius: 10px;
}
.board-rank { font-size: 18px; font-weight: 900; text-align: center; color: var(--muted); grid-row: span 2; }
.board-hero { display: flex; align-items: center; gap: 10px; min-width: 0; }
.board-dot {
  width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0;
  box-shadow: 0 0 8px currentColor; image-rendering: pixelated;
}
.board-hero-main { display: flex; flex-direction: column; min-width: 0; }
.board-hero-main b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-owner { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-right { display: flex; align-items: baseline; gap: 6px; grid-row: span 2; justify-self: end; }
.board-num { font-size: 20px; color: var(--gold); text-shadow: 0 0 10px rgba(255, 207, 92, 0.5); }
.board-label { font-size: 11px; color: var(--muted); }
.board-sub { font-size: 11px; color: var(--muted); grid-column: 2 / 4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-body .empty-hint { border: 1px dashed var(--line); border-radius: 10px; }
.api-config { margin-bottom: 12px; background: #0d1428; border-radius: 8px; padding: 10px 12px; }
.api-config summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.api-config .form-row { margin-top: 10px; }
.api-config-title { font-weight: 700; margin-bottom: 2px; }
.col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-row .col { flex: 1; }
.image-row { display: flex; align-items: center; gap: 10px; }
.image-row input[type=file] { color: var(--muted); font-size: 12px; }
.img-preview-row { display: flex; align-items: flex-end; gap: 14px; margin-top: 8px; }
.img-preview-row figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.img-preview-row img {
  width: 96px; height: 96px; object-fit: contain;
  background: repeating-conic-gradient(#2a2f3a 0 25%, #20242e 0 50%) 0 0/16px 16px;
  border: 1px solid #3a4050; border-radius: 8px; image-rendering: pixelated;
}
.img-preview-row figcaption { font-size: 11px; color: var(--muted); }
#char-image-preview {
  width: 96px; height: 96px; object-fit: cover;
  border: 1px solid var(--line); border-radius: 8px; background: #05070d;
}
.hud-buttons select {
  padding: 6px 8px; font-size: 11px; border-radius: 8px;
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
}
#char-loading { text-align: center; color: var(--gold); padding: 10px; font-size: 13px; }

/* ============ 登录：官方试用账户（无Key） ============ */
.trial-row {
  display: flex; align-items: center; gap: 8px; margin: 8px 0 2px;
  padding: 7px 10px; font-size: 13px; font-weight: 600; color: #a5c4ff;
  background: #12204a; border: 1px solid #2b3f7a; border-radius: 8px;
}
.trial-row input { accent-color: #3c8dff; width: 15px; height: 15px; cursor: pointer; }
.api-config.trial-mode #login-key-fields { display: none; }
.api-config.trial-mode #login-auth-hint { color: #7dd3fc; }

/* ============ 登录：账户（API Key + 密码） ============ */
.api-config .form-row:first-of-type { margin-top: 6px; }
.api-config .form-row { margin-top: 8px; }
.api-config .col label { font-size: 12px; }
.hint a { color: var(--primary); }

/* ============ 铸造角色弹窗：三步流程 ============ */
.gen-loading { text-align: center; padding: 26px 4px; }
.spinner {
  width: 46px; height: 46px; margin: 0 auto 16px;
  border: 4px solid var(--line); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.gen-title { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.gen-sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; min-height: 18px; }
.progress-track {
  height: 10px; background: #0a0f1e; border: 1px solid var(--line);
  border-radius: 6px; overflow: hidden; margin-bottom: 8px;
}
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #3c8dff, #6a5cff, #ffb25e);
  border-radius: 6px; transition: width .25s ease;
}
.gen-percent { color: var(--gold); font-size: 13px; font-weight: 700; }

/* 生成结果预览（角色形象 + 各项参数） */
.result-preview-wrap {
  background: #0a0f1e; border: 1px solid var(--line); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  padding: 8px; margin-bottom: 12px;
}
#char-preview { max-width: 100%; display: block; }

/* 四套动作动画预览按钮（跑动/攻击/躲避/死亡 + 自动循环） */
.pose-preview-row {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  margin: 2px 0 6px;
}
.pose-btn {
  padding: 5px 10px; font-size: 12px; font-weight: 600;
  color: var(--muted); background: #101830; border: 1px solid var(--line);
  border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.pose-btn:hover { color: var(--text); border-color: var(--primary); }
.pose-btn.active { color: #0a0f1e; background: var(--gold); border-color: var(--gold); }
.pose-btn .synth-dot { margin-left: 2px; font-size: 10px; }
.pose-preview-hint { text-align: center; color: var(--muted); font-size: 11px; margin-bottom: 8px; min-height: 14px; }

.result-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.result-head b { font-size: 19px; color: var(--text); }
.result-head span { color: var(--muted); font-size: 13px; } 
.result-badge { display: inline-block; margin-left: auto; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.result-badge.real { color: #9dffb0; background: rgba(32, 132, 61, 0.18); border: 1px solid rgba(90, 220, 130, 0.45); }
.result-badge.sim { color: #ffd166; background: rgba(158, 108, 8, 0.18); border: 1px solid rgba(255, 200, 90, 0.45); }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stat-item { background: #0d1428; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.stat-item .k { color: var(--muted); font-size: 11px; margin-bottom: 3px; }
.stat-item .v { font-size: 14px; font-weight: 700; word-break: break-all; }
.result-actions { display: flex; gap: 10px; }
.result-actions .btn { flex: 1; }

/* 新增 API Key 面板 */
#add-key-panel { border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 10px; }

/* ============ 我的角色弹窗 ============ */
.my-chars-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 56vh; overflow-y: auto; padding-right: 2px;
}
.my-char-card { background: #0d1428; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.my-char-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.my-char-head .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.my-char-head .my-char-img { width: 34px; height: 34px; object-fit: contain; image-rendering: pixelated; flex-shrink: 0; background: radial-gradient(circle at 50% 35%, #1b2542, #05070d); border-radius: 6px; border: 1px solid var(--line); }
.my-char-head b { font-size: 15px; }
.my-char-head .title { color: var(--muted); font-size: 12px; }
.my-char-head .badge {
  margin-left: auto; font-size: 11px; padding: 2px 8px; border-radius: 12px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.my-char-stats { color: var(--muted); font-size: 12px; margin-bottom: 8px; line-height: 1.6; }
.my-char-ops { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.my-char-head .badge.origin { color: #ffd23f; border-color: rgba(255,210,63,.5); background: rgba(255,210,63,.12); }
.my-char-ops .btn { padding: 5px 10px; font-size: 12px; }

/* 英雄基地：容量徽章 + 角色详情面板 */
.modal-head .points-badge { margin-left: 8px; }
.hero-detail {
  position: relative; margin-bottom: 10px; padding: 12px;
  background: linear-gradient(180deg, #111a33, #0a1022);
  border: 1px solid #3c5fd9; border-radius: 12px; box-shadow: 0 0 18px rgba(60, 95, 217, .25);
}
.hero-detail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.hero-detail-head b { font-size: 17px; color: #ffe9a8; text-shadow: 0 0 10px rgba(255, 205, 96, .45); }
.hero-detail .modal-close.small { position: static; width: 24px; height: 24px; line-height: 22px; font-size: 12px; }
.hero-detail-img {
  float: left; width: 96px; height: 96px; object-fit: contain; image-rendering: pixelated;
  margin: 0 10px 6px 0; border-radius: 10px; border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 35%, #1b2542, #05070d);
}
.hero-detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.hero-detail-grid .stat-item { background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.hero-detail-grid .stat-item .k { color: var(--muted); font-size: 11px; }
.hero-detail-grid .stat-item .v { color: #e8eefc; font-size: 13px; margin-top: 2px; word-break: break-all; }

/* 禁用按钮 */
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn:disabled:hover { filter: none; transform: none; }

/* ============ Toast ============ */
#toast-box { position: fixed; top: 64px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: rgba(20,27,49,.95); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 10px; font-size: 13px;
  animation: toastIn .2s ease-out; max-width: 320px;
}
.toast.err { border-color: var(--danger); color: #ffb4b4; }
.toast.ok { border-color: var(--green); }
@keyframes toastIn { from { transform: translateX(20px); opacity: 0; } }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .game-title { font-size: 30px; }
  #bottom { height: 40vh; }
  #bottom-cols { grid-template-columns: 1fr; overflow-y: auto; }
  .bcol { border-right: none; border-bottom: 1px solid var(--line); min-height: 180px; }
  .members-box { display: none; }
}


/* 右上角背景音乐开关 */
#btn-sound { min-width: 84px; }
#btn-sound.muted { opacity: 0.55; }

/* ============ 右上角中英文切换按钮 ============ */
#btn-lang {
  position: fixed; top: 10px; right: 14px; z-index: 120;
  min-width: 44px; padding: 5px 12px;
  font-size: 13px; font-weight: 700; letter-spacing: .5px;
  background: rgba(20,27,49,.85); backdrop-filter: blur(6px);
  border: 1px solid var(--line); color: var(--accent);
  cursor: pointer;
}
#btn-lang:hover { border-color: var(--accent); box-shadow: 0 0 14px rgba(255,178,94,.35); }
/* 房间顶栏为固定按钮预留空间，避免与右侧按钮重叠 */
#topbar { padding-right: 74px; }
@media (max-width: 640px) {
  #btn-lang { top: 6px; right: 8px; padding: 4px 10px; }
  #topbar { padding-right: 58px; }
}

/* ============ 奖励系统：积分 / 宝箱 / 坐骑 / 背包 ============ */
.points-badge { color: #ffd23f; font-weight: 800; }
#my-points { min-width: 74px; text-align: center; }

/* 对局结算面板（积分发放） */
#reward-overlay {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6,10,26,.42);
}
.reward-card {
  min-width: 340px; max-width: 480px; max-height: 70%;
  overflow: auto;
  background: linear-gradient(160deg, rgba(28,36,70,.97), rgba(13,18,40,.97));
  border: 1px solid rgba(255,210,63,.55);
  border-radius: 16px;
  box-shadow: 0 0 34px rgba(255,210,63,.35), 0 12px 40px rgba(0,0,0,.6);
  padding: 14px 16px 16px;
  animation: reward-pop .35s ease-out;
}
@keyframes reward-pop {
  0% { transform: scale(.72) translateY(24px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.reward-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
#reward-title { font-size: 19px; font-weight: 900; color: #ffd23f; text-shadow: 0 2px 8px rgba(255,210,63,.4); }
.reward-mode { text-align: center; color: #9fb6ff; font-size: 13px; margin: 4px 0 10px; }
.reward-list { display: flex; flex-direction: column; gap: 6px; }
.reward-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 10px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
}
.reward-row.me { border-color: rgba(255,210,63,.6); background: rgba(255,210,63,.08); }
.reward-mvp { border-color: rgba(255,180,102,.7); background: linear-gradient(90deg, rgba(255,180,102,.2), rgba(255,210,63,.05)); }
.reward-mvp .reward-rank { color: #ffb066; font-weight: 900; }
.reward-rank { width: 64px; font-size: 12px; color: #9fb6ff; }
.reward-who { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reward-pts { font-weight: 900; color: #ffd23f; font-size: 16px; }
.reward-bonus { font-size: 11px; color: #7de3a8; }
.reward-hint { text-align: center; color: #8b96b8; font-size: 12px; margin-top: 10px; }

/* 宝箱开箱展示 */
#chest-overlay {
  position: absolute; inset: 0; z-index: 45;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6,10,26,.5);
}
.chest-card {
  position: relative; text-align: center;
  min-width: 260px; max-width: 320px;
  background: radial-gradient(120% 120% at 50% 0%, rgba(50,44,90,.97), rgba(15,18,40,.98));
  border: 1px solid rgba(255,210,63,.6); border-radius: 18px;
  padding: 26px 22px 20px;
  box-shadow: 0 0 44px rgba(255,210,63,.45);
  overflow: hidden;
  animation: reward-pop .32s ease-out;
}
.chest-beam {
  position: absolute; top: -60px; left: 50%; width: 130px; height: 160px;
  margin-left: -65px;
  background: conic-gradient(from 180deg at 50% 100%, transparent, rgba(255,224,130,.85), transparent 40%);
  animation: chest-beam 1.2s linear infinite;
}
@keyframes chest-beam {
  0% { transform: rotate(0deg); opacity: .75; }
  100% { transform: rotate(360deg); opacity: .75; }
}
.chest-item-icon { font-size: 64px; line-height: 1.2; position: relative; animation: chest-item-pop .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes chest-item-pop {
  0% { transform: scale(0) rotate(-140deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.chest-item-name { position: relative; font-size: 20px; font-weight: 900; color: #ffd23f; margin-top: 4px; }
.chest-item-sub { position: relative; font-size: 12px; color: #9fb6ff; margin: 4px 0 14px; }
.chest-auto-hint { position: relative; font-size: 11px; color: #8b96b8; margin: 0 0 4px; }
#btn-close-chest { position: relative; }

/* 铸造结果：坐骑 */
.result-mount {
  margin: 8px auto; padding: 8px 12px; border-radius: 10px;
  background: rgba(255,210,63,.1); border: 1px dashed rgba(255,210,63,.5);
  font-size: 13px; color: #ffd23f; text-align: center;
}
.result-mount-actions { display: flex; gap: 8px; justify-content: center; margin: 6px 0; }
#mount-kind { max-width: 90px; }

/* 我的背包 */
.modal-subhead {
  display: flex; align-items: center; justify-content: space-between;
  margin: 14px 0 6px; font-weight: 800; color: #cdd7ff;
}
.inventory-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; }
.inv-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 10px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09);
}
.inv-item .ico { font-size: 20px; }
.inv-item .meta { flex: 1; min-width: 0; }
.inv-item .nm { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-item .sub { font-size: 11px; color: #8b96b8; }
.inv-item.equipped { border-color: rgba(255,210,63,.55); background: rgba(255,210,63,.07); }
.inv-op { display: flex; align-items: center; gap: 6px; }
.inv-op select { max-width: 130px; font-size: 12px; }

/* 角色卡片：坐骑标签 + 佩戴按钮 */
.c-mount-tag { color: #ffd23f; margin-left: 6px; }
.c-mount-btn {
  border: 1px solid rgba(255,210,63,.55); background: rgba(255,210,63,.12);
  color: #ffd23f; border-radius: 8px; padding: 3px 8px;
  font-size: 12px; cursor: pointer;
}
.c-mount-btn:hover { background: rgba(255,210,63,.25); }

/* 铸造弹窗：新增/删除 Key 按钮组 */
.inline-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.btn.ghost.danger { color: #ff8f8f; border-color: rgba(255, 110, 110, 0.45); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; filter: none; transform: none; pointer-events: auto; }

/* ==================== 胜利收编卡牌（击杀/推塔后对方英雄收编展示） ==================== */
#capture-overlay {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(10,14,30,.55), rgba(4,6,14,.82));
  backdrop-filter: blur(3px);
}
#capture-overlay.hidden { display: none; }
#capture-card {
  width: min(560px, 92vw); max-height: 78vh; overflow: auto;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 22px 20px 18px; border-radius: 18px;
  background: linear-gradient(160deg, #241a08 0%, #3a2a10 45%, #241a08 100%);
  border: 2px solid #e8b64c; box-shadow: 0 0 40px rgba(232,182,76,.35), inset 0 0 22px rgba(0,0,0,.5);
  animation: captureSpinIn .9s cubic-bezier(.2,.9,.3,1.2) both;
  transform-style: preserve-3d;
}
#capture-card::after {
  content: ''; position: absolute; inset: 0; border-radius: 18px; pointer-events: none;
  background: repeating-linear-gradient(115deg, rgba(255,214,120,.06) 0 12px, transparent 12px 24px);
}
@keyframes captureSpinIn {
  0% { transform: perspective(900px) rotateY(-95deg) scale(.75); opacity: 0; }
  60% { transform: perspective(900px) rotateY(14deg) scale(1.03); opacity: 1; }
  100% { transform: perspective(900px) rotateY(0deg) scale(1); }
}
.capture-head { text-align: center; display: flex; flex-direction: column; gap: 4px; }
.capture-title {
  font-size: 24px; font-weight: 900; color: #ffd76e;
  text-shadow: 0 2px 10px rgba(0,0,0,.65), 0 0 18px rgba(255,200,90,.45);
  letter-spacing: 1px; animation: captureTitlePop .7s cubic-bezier(.2,.9,.3,1.3) both;
}
@keyframes captureTitlePop {
  0% { transform: scale(.78); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}
.capture-sub { font-size: 13px; color: #e8d9ae; opacity: .92; }
#capture-list { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.capture-hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; border-radius: 14px;
  background: linear-gradient(100deg, rgba(255,214,120,.2), rgba(255,180,60,.08) 55%, rgba(255,214,120,.16));
  border: 1px solid rgba(232,182,76,.65);
  box-shadow: 0 0 14px rgba(232,182,76,.22), inset 0 0 18px rgba(255,214,120,.08);
  animation: captureHeroIn .55s cubic-bezier(.2,.9,.3,1.35) both;
}
.capture-hero::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255,244,200,.28), transparent);
  transform: skewX(-18deg); animation: captureShine 2.6s ease-in-out infinite;
}
@keyframes captureShine {
  0% { left: -60%; } 55% { left: 130%; } 100% { left: 130%; }
}
@keyframes captureHeroIn {
  0% { transform: perspective(600px) rotateY(90deg) translateY(6px); opacity: 0; }
  100% { transform: perspective(600px) rotateY(0deg) translateY(0); opacity: 1; }
}
.capture-hero-face {
  position: relative; flex: 0 0 88px; width: 88px; height: 88px; border-radius: 12px; overflow: visible;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 50% 38%, rgba(255,220,130,.28), rgba(10,14,24,.72) 72%),
    rgba(10,14,24,.6);
  border: 2px solid #e8b64c;
  box-shadow: 0 0 16px rgba(255,200,90,.5), inset 0 0 12px rgba(255,214,120,.16);
  animation: captureFaceGlow 1.6s ease-in-out infinite;
}
@keyframes captureFaceGlow {
  0%,100% { box-shadow: 0 0 12px rgba(255,200,90,.4), inset 0 0 12px rgba(255,214,120,.14); }
  50% { box-shadow: 0 0 24px rgba(255,200,90,.75), inset 0 0 16px rgba(255,214,120,.26); }
}
.capture-hero-face img {
  max-width: 100%; max-height: 100%; border-radius: 10px;
  image-rendering: pixelated; object-fit: contain;
}
.capture-hero-face .dot { width: 26px; height: 26px; border-radius: 50%; background: #e8b64c; }
.capture-hero-crown {
  position: absolute; top: -12px; right: -9px; font-size: 20px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.55)); transform: rotate(12deg);
  animation: captureCrownBob 1.3s ease-in-out infinite;
}
@keyframes captureCrownBob { 0%,100% { transform: rotate(10deg) translateY(0); } 50% { transform: rotate(16deg) translateY(-3px); } }
.capture-hero-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; position: relative; z-index: 1; }
.capture-hero-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.capture-hero-name b {
  font-size: 19px; color: #fff2cc; letter-spacing: .5px;
  text-shadow: 0 1px 6px rgba(0,0,0,.6), 0 0 10px rgba(255,200,90,.35);
}
.capture-hero-new {
  font-size: 11px; font-weight: 800; color: #3a2405;
  background: linear-gradient(135deg, #ffe49a, #ffc34d);
  border: 1px solid #fff3cf; border-radius: 999px; padding: 2px 8px;
  box-shadow: 0 0 10px rgba(255,200,90,.55);
  animation: captureNewPulse 1.2s ease-in-out infinite;
}
@keyframes captureNewPulse {
  0%,100% { transform: scale(1); box-shadow: 0 0 8px rgba(255,200,90,.45); }
  50% { transform: scale(1.08); box-shadow: 0 0 16px rgba(255,200,90,.8); }
}
.capture-hero-body span { font-size: 12px; color: #d9c28c; }
.capture-hero-body .capture-evict { color: #ffb26b; font-weight: 600; }
.capture-spark {
  position: absolute; color: #ffe9a8; font-style: normal; font-size: 14px;
  text-shadow: 0 0 8px rgba(255,220,130,.9); animation: captureTwinkle 1.5s ease-in-out infinite;
  pointer-events: none; z-index: 0;
}
.capture-spark.s1 { top: 6px; right: 10px; animation-delay: 0s; }
.capture-spark.s2 { bottom: 8px; right: 32px; font-size: 11px; animation-delay: .4s; }
.capture-spark.s3 { top: 12px; left: 104px; font-size: 10px; animation-delay: .8s; }
@keyframes captureTwinkle {
  0%,100% { opacity: .25; transform: scale(.8) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.25) rotate(18deg); }
}
#btn-capture-close { margin-top: 4px; }
