﻿:root {
  --bg: #1a2238;
  --panel: #24304f;
  --panel2: #2e3c63;
  --text: #eef2ff;
  --muted: #9aa7c7;
  --accent: #f7c948;
  --border: #33406a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  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: 16px;
  padding: 16px 24px;
  background: linear-gradient(180deg, #1f2a47, #16203a);
  border-bottom: 2px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.logo { font-size: 22px; font-weight: 800; color: var(--accent); letter-spacing: 1px; }
.sub { font-size: 13px; color: var(--muted); }

.toolbar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 16px 24px 6px;
}
.toolbar input {
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  padding: 9px 14px; border-radius: 8px; font-size: 14px;
}
#keyword { width: 240px; }
.count { color: var(--muted); font-size: 13px; margin-left: auto; }
.order-btn { padding: 9px 16px; font-size: 14px; background: var(--panel); color: var(--text); border: 1px solid var(--border); }
.order-btn:hover { border-color: var(--accent); color: var(--accent); }

/* 自定义下拉（带图标） */
.dropdown { position: relative; display: inline-block; }
.dropdown-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  padding: 9px 14px; border-radius: 8px; font-size: 14px; cursor: pointer;
  min-width: 118px; justify-content: space-between;
}
.dropdown-trigger .elem-icon { width: 20px; height: 20px; }
.dropdown-arrow { color: var(--muted); margin-left: 4px; }
.dropdown-menu {
  position: absolute; top: 100%; left: 0; z-index: 50;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  margin-top: 4px; min-width: 178px; max-height: 340px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.dropdown-menu .opt {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; cursor: pointer; font-size: 14px;
}
.dropdown-menu .opt:hover { background: var(--panel2); }
.dropdown-menu .opt.active { background: #3a4874; }
.dropdown-menu .opt .elem-icon { width: 20px; height: 20px; }
.dropdown-menu .opt.all .opt-txt { color: var(--muted); }
.opt-cnt { margin-left: auto; font-size: 11px; color: var(--muted); padding-left: 10px; }

main { padding: 12px 24px 40px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 60px 0; }

.card {
  position: relative;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; cursor: pointer; text-align: center; padding-bottom: 10px;
  transition: transform .12s, border-color .12s;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); }
.card img { width: 100%; aspect-ratio: 1/1; object-fit: contain; background: #141c30; }
.dexno {
  position: absolute; left: 0; top: 0; z-index: 2;
  font-size: 11px; font-weight: 700; color: #1a2238; background: var(--accent);
  padding: 1px 8px; border-bottom-right-radius: 10px;
}
.card .cname { font-size: 14px; font-weight: 700; margin-top: 6px; }
.card .cmeta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 4px; flex-wrap: wrap;
}
.card .spec { font-size: 11px; color: var(--muted); }

.badge {
  display: inline-block; font-size: 11px; padding: 2px 10px; border-radius: 10px;
  background: #3a4874; color: var(--accent);
}
.badge.elem-badge,
.card .elem-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: transparent; padding: 0; margin-top: 0;
}
.elem-icon { width: 22px; height: 22px; object-fit: contain; vertical-align: middle; }
.elem-txt { font-size: 11px; color: var(--accent); }
.spec-badge { background: #3a4874; color: #c9d6ff; }

.pager { display: flex; gap: 16px; align-items: center; justify-content: center; margin-top: 28px; }
.btn {
  background: var(--accent); color: #1a2238; border: none; padding: 9px 22px;
  border-radius: 8px; font-size: 14px; font-weight: 700; cursor: pointer;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.pageinfo { color: var(--muted); font-size: 14px; }

/* 详情弹窗 */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-body {
  background: var(--panel); border-radius: 16px; max-width: 460px; width: 100%;
  max-height: 86vh; overflow-y: auto; position: relative; padding: 18px 20px 14px;
}
.close {
  position: absolute; right: 12px; top: 6px; background: none; border: none;
  color: var(--muted); font-size: 26px; cursor: pointer; line-height: 1;
}
.close:hover { color: var(--text); }

.detail-dexno { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: .5px; }
.detail-name { font-size: 20px; font-weight: 800; margin-top: 2px; }
.detail-badges { display: flex; align-items: center; gap: 8px; margin: 8px 0 6px; }

.detail-figure {
  background: #141c30; border-radius: 12px;
  /* 上方留出固定图片区，底部 40px 专门放切换按钮：
     图片按不同动画换尺寸时，按钮位置不受影响 */
  padding: 8px 8px 40px;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  margin: 8px 0 14px;
  height: 200px;
}
.detail-img {
  width: 130px; height: 130px; object-fit: contain; max-width: 100%;
  image-rendering: -webkit-optimize-contrast;
}

/* 攻击/超杀：宠物固定在场景左侧（战斗站位），受击保持居中 */
.detail-img.is-attack {
  position: absolute; left: 6px; bottom: 40px;
  max-width: none;
  z-index: 2;   /* 攻击方图层高于靶子，特效才能盖在对方身上 */
}
.detail-img.is-hit {
  position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%);
  max-width: none;
}
/* 演示靶子：位置由 JS 按攻击图的位置算出，平时待机、被命中时受击 */
.detail-dummy {
  position: absolute; left: 240px; bottom: 40px;
  max-width: none; display: none;
  transform: scaleX(-1);
  z-index: 1;
}
.detail-dummy.on { display: block; }

/* 命中伤害飘字 */
.dmg-pop {
  position: absolute; left: 0; bottom: 0;
  transform: translate(-50%, 0);
  font-size: 18px; font-weight: 800; line-height: 1;
  color: #ffd84d;
  text-shadow: 0 2px 0 #8a3b00, 0 0 6px rgba(255, 160, 0, .8);
  opacity: 0; pointer-events: none;
  z-index: 3;
}
.dmg-pop.show { animation: dmgFloat .8s ease-out forwards; }
@keyframes dmgFloat {
  0%   { opacity: 0; transform: translate(-50%, 6px) scale(.7); }
  18%  { opacity: 1; transform: translate(-50%, -2px) scale(1.15); }
  40%  { transform: translate(-50%, -12px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -30px) scale(1); }
}

/* 待机 / 攻击 / 受击 切换：绝对定位钉在底部，图片换尺寸时不会跟着上下跑 */
.anim-switch {
  position: absolute; left: 0; right: 0; bottom: 8px;
  display: flex; gap: 6px; justify-content: center;
}
.anim-switch button {
  background: var(--panel); color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 14px; font-size: 12px; cursor: pointer;
  font-family: inherit; transition: all .15s;
}
.anim-switch button:hover { color: var(--text); border-color: var(--accent); }
.anim-switch button.on {
  background: var(--accent); color: #22304f;
  border-color: var(--accent); font-weight: 700;
}
.no-anim { color: var(--muted); font-size: 13px; padding: 40px 0; }

.detail-row {
  display: flex; gap: 10px; font-size: 13px; padding: 5px 0;
  border-bottom: 1px dashed rgba(255,255,255,.07);
}
.detail-row .k { color: var(--muted); min-width: 42px; flex: none; }
.detail-row .v { color: var(--text); }

.detail-story {
  font-size: 13px; line-height: 1.65; color: #d7e0f7;
  background: #1e2942; border-left: 3px solid var(--accent);
  border-radius: 6px; padding: 10px 12px; margin-top: 12px;
}

.detail-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.detail-nav .btn { flex: 1; padding: 8px 0; font-size: 13px; }

@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  #keyword { width: 100%; }
  .count { margin-left: 0; width: 100%; }
}


/* 新动画加载完成前先隐藏，避免旧图被拉伸 / 旧动画继续播 */
.detail-img.is-loading { opacity: 0; }






