/* 神奥联盟·快速对战 M2 SPA（内网公测版样式） */
:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel2: #273549;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --gold: #fbbf24;
  --red: #f87171;
  --green: #4ade80;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
}
.hidden { display: none !important; }
#topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--panel);
  border-bottom: 1px solid #334155; position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; color: var(--accent); }
#accountInfo { color: var(--muted); font-size: 13px; margin-left: auto; }
main { max-width: 1080px; margin: 0 auto; padding: 16px; }
.loading { color: var(--muted); padding: 40px; text-align: center; }

.panel { background: var(--panel); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.panel h2 { margin: 0 0 10px; font-size: 16px; color: var(--gold); }
.panel h3 { margin: 10px 0 6px; font-size: 14px; color: var(--accent); }

button {
  background: var(--accent); color: #082f49; border: 0; border-radius: 6px;
  padding: 7px 14px; font-weight: 600; cursor: pointer; font-size: 13px;
}
button:disabled { opacity: .4; cursor: not-allowed; }
button.ghost { background: var(--panel2); color: var(--text); }
button.danger { background: var(--red); color: #450a0a; }
button.small { padding: 3px 8px; font-size: 12px; }
input, select {
  background: var(--panel2); color: var(--text); border: 1px solid #475569;
  border-radius: 6px; padding: 7px 10px; font-size: 13px; margin: 2px 4px 2px 0;
}
label { font-size: 13px; color: var(--muted); margin-right: 4px; }

.events { font-size: 12px; color: var(--muted); max-height: 110px; overflow-y: auto; }
.events div { padding: 1px 0; }

.jp { color: var(--gold); font-weight: 700; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 8px; font-size: 11px; background: var(--panel2); color: var(--muted); margin-left: 6px; }
.badge.cosmos { background: #4c1d95; color: #ddd6fe; }

.cards { display: flex; flex-wrap: wrap; gap: 10px; }
.card {
  width: 118px; background: var(--panel2); border-radius: 8px; padding: 6px;
  border: 2px solid transparent; cursor: pointer; text-align: center;
}
.card.selected { border-color: var(--gold); }
.card img { width: 100%; height: auto; object-fit: contain; border-radius: 6px; display: block; min-height: 60px; background: #0b1220; cursor: zoom-in; }
.card .cname { font-size: 12px; margin-top: 4px; }
.card .cstats { font-size: 11px; color: var(--muted); }

table.team { width: 100%; border-collapse: collapse; font-size: 13px; }
table.team th, table.team td { padding: 6px 8px; border-bottom: 1px solid #334155; text-align: left; vertical-align: middle; }
table.team th { color: var(--muted); font-weight: 500; font-size: 12px; }
.slot-img { width: 46px; height: 62px; object-fit: contain; border-radius: 6px; background: #0b1220; cursor: zoom-in; }

/* 点击放大（卡详情 lightbox） */
.lightbox {
  position: fixed; inset: 0; background: rgba(2, 6, 23, .92); z-index: 100;
  display: flex; align-items: center; justify-content: center; cursor: zoom-out; padding: 24px;
}
.lightbox .lb-panel {
  display: flex; gap: 18px; max-width: min(94vw, 860px); max-height: 88vh;
  background: var(--panel); border-radius: 12px; padding: 18px; cursor: default;
  overflow: auto; box-shadow: 0 8px 40px rgba(0,0,0,.6);
}
.lightbox img { width: min(40vw, 300px); max-height: 74vh; object-fit: contain; border-radius: 10px; background: #0b1220; }
.lightbox .lb-info { flex: 1; min-width: 260px; color: var(--text); font-size: 13px; }
.lightbox .lb-info h3 { margin: 0 0 6px; color: var(--gold); font-size: 16px; }
.lightbox .lb-info .lb-sub { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.lightbox .lb-info .lb-sec { margin-top: 10px; }
.lightbox .lb-info .lb-sec b { color: var(--accent); }
.lightbox .lb-info .lb-move { margin: 4px 0; padding: 5px 8px; background: #0b1220; border-radius: 6px; }
.lightbox .lb-info .lb-move .m-head { font-weight: 600; }
.lightbox .lb-info .lb-move .m-eff { color: var(--muted); font-size: 12px; margin-top: 2px; }
.lightbox .lb-close { position: absolute; top: 14px; right: 20px; color: var(--muted); font-size: 14px; cursor: pointer; }

.battlefield { display: flex; gap: 16px; align-items: flex-start; }
.side { flex: 1; }
.mon {
  background: var(--panel2); border-radius: 10px; padding: 10px; margin-bottom: 10px;
}
.mon.active { outline: 2px solid var(--gold); }
.mon .mname { font-weight: 700; }
.mon .hp { height: 10px; background: #450a0a; border-radius: 5px; overflow: hidden; margin: 6px 0; }
.mon .hp > div { height: 100%; background: var(--green); }
.mon .meta { font-size: 12px; color: var(--muted); }
.moves { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.status-tag { display: inline-block; font-size: 11px; color: #fca5a5; margin-right: 4px; }

.logbox {
  max-height: 320px; overflow-y: auto; font-size: 12px; color: var(--muted);
  background: #0b1220; border-radius: 8px; padding: 8px 10px;
}
.logbox .lt { color: #64748b; margin-right: 6px; }
.unsupported { background: #3b0764; color: #e9d5ff; font-size: 12px; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }
.unsupported summary { cursor: pointer; }
.banner { padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.banner.win { background: #14532d; color: #bbf7d0; }
.banner.loss { background: #7f1d1d; color: #fecaca; }
.banner.info { background: #1e3a8a; color: #bfdbfe; }

.authbox { max-width: 420px; margin: 60px auto; }
.authbox .panel { text-align: center; }
.authbox input { width: 90%; margin: 6px 0; }
.authbox button { width: 90%; margin-top: 8px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.7; text-align: left; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ===== 构筑界面 · 游戏化（2026-11-21 v2）：精灵球球位 / 点按 chips / 抽屉管理 ===== */
.build-grid { display: grid; grid-template-columns: minmax(340px, 420px) 1fr; gap: 14px; align-items: start; }
.build-left, .build-right { display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 980px) { .build-grid { grid-template-columns: 1fr; } }

/* HUD 顶栏 */
.hud { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; }
.hud-round { font-size: 20px; font-weight: 800; color: var(--gold); }
.hud-round i { font-style: normal; font-size: 12px; color: var(--muted); font-weight: 500; }
.hud-wins { font-weight: 700; color: var(--green); }
.jp-coin { background: radial-gradient(circle at 35% 30%, #fde68a, #f59e0b 70%); color: #78350f; font-weight: 800; border-radius: 999px; padding: 3px 14px; font-size: 15px; box-shadow: 0 2px 6px rgba(245, 158, 11, .35); }
.hud-events { background: var(--panel); border-radius: 8px; padding: 6px 12px; margin: -6px 0 12px; }

/* 点按 chips（替代全部下拉） */
.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; border-radius: 999px; background: var(--panel2); border: 1.5px solid #475569; font-size: 13px; cursor: pointer; user-select: none; transition: border-color .12s, background .12s; }
.chip:hover { border-color: var(--accent); }
.chip.active { border-color: var(--gold); background: #3b2f0b; color: var(--gold); font-weight: 700; box-shadow: 0 0 8px rgba(251, 191, 36, .35); }
.chip.locked { opacity: .45; cursor: not-allowed; }
.chip.danger-target { border-color: var(--red); background: #450a0a; color: #fecaca; animation: chip-pulse 1s infinite; }
@keyframes chip-pulse { 50% { box-shadow: 0 0 10px rgba(248, 113, 113, .7); } }
.chip .price { font-style: normal; color: var(--gold); font-weight: 800; font-size: 12px; }
.chip .own { color: var(--green); font-size: 11px; }
.chip .chip-x { font-style: normal; color: var(--red); cursor: pointer; font-weight: 700; padding: 0 2px; }
.chip-tm { border-style: dashed; color: var(--accent); }
.d-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.d-label { min-width: 52px; color: var(--muted); font-size: 12px; font-weight: 700; }

/* 大按钮 */
.btn-big { font-size: 15px; font-weight: 800; padding: 11px 26px; border-radius: 10px; background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #fff; letter-spacing: 1px; box-shadow: 0 4px 14px rgba(37, 99, 235, .4); }
.btn-big.ghost { background: var(--panel2); color: var(--text); box-shadow: none; }
.btn-ready { width: 100%; background: linear-gradient(135deg, #f59e0b, #ea580c); color: #fff; font-size: 17px; padding: 14px; box-shadow: 0 4px 18px rgba(234, 88, 12, .45); }

/* 候选大卡 */
.cand-cards { gap: 12px; }
.cand-cards .card { width: 172px; padding: 8px; }
.cand-card img { min-height: 130px; cursor: zoom-in; }
.cand-card .cname { font-size: 13px; }
.pad-btn { margin-top: 6px; }

/* 商店 */
.shop-tabs .tab-on { background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #fff; }
.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-height: 300px; overflow-y: auto; margin-top: 6px; }
.shop-card { background: var(--panel2); border: 1px solid #334155; border-radius: 8px; padding: 8px 10px; display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; transition: border-color .12s; }
.shop-card:hover { border-color: var(--accent); }
.shop-card.poor { opacity: .5; }
.shop-card i.price { font-style: normal; color: var(--gold); font-weight: 800; }
.shop-card b.own { color: var(--green); font-size: 11px; }

/* 精灵球球位 */
.slots-row { display: flex; gap: 18px; flex-wrap: wrap; padding: 10px 6px 26px; }
.ball-slot { width: 88px; height: 88px; border-radius: 50%; position: relative; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: conic-gradient(from 210deg, #7f1d1d 0 40%, #1e293b 40% 46%, #f8fafc 46% 94%, #1e293b 94% 100%);
  border: 3px solid #475569; box-shadow: inset 0 0 12px rgba(0,0,0,.55), 0 3px 8px rgba(0,0,0,.4); transition: transform .1s; }
.ball-slot:hover { transform: translateY(-2px); }
.ball-slot.empty { background: #141f36; border-style: dashed; border-color: #334155; }
.ball-slot.empty .bs-plus { color: #475569; font-size: 26px; font-weight: 300; }
.ball-slot img { width: 66px; height: 66px; border-radius: 50%; object-fit: contain; background: #0b1220; border: 2px solid #0f172a; }
.ball-slot.open { border-color: var(--gold); box-shadow: 0 0 12px rgba(251,191,36,.5); }
.ball-slot.targetable { border-color: var(--gold); animation: ball-pulse 1s infinite; }
@keyframes ball-pulse { 50% { box-shadow: 0 0 18px rgba(251, 191, 36, .9); } }
.bs-name { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); width: 104px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 放球提示条 */
.arm-hint { background: #3b2f0b; border: 1px solid var(--gold); color: var(--gold); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 4px 0 10px; display: flex; align-items: center; gap: 10px; }

/* 抽屉 */
.slot-drawer { background: #0b1220; border: 1px solid #334155; border-radius: 12px; padding: 12px 14px; margin-top: 8px; }
.drawer-head { margin-top: 0; }
.drawer-img { width: 84px; height: 112px; object-fit: contain; border-radius: 10px; background: var(--panel2); cursor: zoom-in; border: 1px solid #334155; }
.ability-prev { font-size: 11px; color: var(--muted); flex-basis: 100%; }
.pc-title { margin-top: 14px; }
.pc-grid { max-height: 300px; overflow-y: auto; }
.pc-card.armed { border-color: var(--gold); box-shadow: 0 0 14px rgba(251, 191, 36, .6); transform: translateY(-3px); }
.inv-chip .chip-x { font-style: normal; color: var(--red); cursor: pointer; font-weight: 700; }

/* 完成构筑吸底 */
.readybar { position: sticky; bottom: 10px; z-index: 5; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(16px); padding: 10px 20px; border-radius: 999px; font-size: 13px; font-weight: 600; opacity: 0; transition: all .25s ease; z-index: 200; pointer-events: none; max-width: 82vw; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-info { background: #1e3a8a; color: #bfdbfe; }
.toast-ok { background: #14532d; color: #bbf7d0; }
.toast-error { background: #7f1d1d; color: #fecaca; }

/* 球位选择弹层按钮 */
.slotpick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.slotpick-btn { display: flex; align-items: center; gap: 8px; text-align: left; }
.slotpick-btn b { color: var(--gold); }
.slotpick-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }

/* 步进器 */
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper .step-val { min-width: 22px; text-align: center; color: var(--gold); font-size: 15px; }

/* 球位/PC 预览用正面动图（卡面只在详情灯箱/抽屉） */
.ball-slot img.bs-sprite { background: transparent; border: 0; width: 72px; height: 72px; }
.pc-card img.pc-sprite { background: radial-gradient(circle at 50% 62%, #16324a, transparent 72%); min-height: 80px; }

/* 统一宝可梦详情面板（管理模式） */
.mon-panel { align-items: flex-start; }
.mon-info { min-width: 320px; max-width: 480px; }
.mon-mgr { border-top: 1px solid #1e293b; margin-top: 12px; padding-top: 6px; }
.mon-mgr .d-label { min-width: 48px; }

/* 抽屉式详情（页内展开，非弹窗）与换位armed态 */
.mon-drawer { display: flex; gap: 14px; align-items: flex-start; margin-top: 10px; }
.mon-drawer .drawer-left { flex-shrink: 0; }
.mon-drawer .mon-info { flex: 1; min-width: 240px; }
.mon-drawer h3 { margin-top: 0; }
.evo-preview { flex-basis: 100%; margin-top: 8px; padding: 10px; background: #0f1a30; border: 1px dashed #475569; border-radius: 10px; }
.ball-slot.armed { border-color: var(--accent); box-shadow: 0 0 14px rgba(56, 189, 248, .75); animation: ball-pulse 1.2s infinite; }
