/* =========================================================================
   宠物弹窗 v2 候选样式（GAME 侧测试件，不参与线上加载）
   生效方式：index.html </head> 前追加 <link rel="stylesheet" href="css/pet-ui-v2.css">
   设计目标：方便 / 直观 / 好看 / 快捷
   ========================================================================= */

/* ---------- 0. 基础变量（拿不到 tokens 时用兜底值） ---------- */
#petModal {
  --p-gold: var(--lk-gold, #c48a26);
  --p-ink: var(--lk-ink, #232323);
  --p-muted: var(--lk-muted, #68625b);
  --p-line: var(--lk-line, #ded6c8);
  --p-surface: var(--lk-surface, #fffdfa);
  --p-green: var(--lk-green, #4f9f64);
}

/* ---------- 1. 外框：固定高度、内部滚动（修 P0：按钮被顶出屏幕） ---------- */
#petModal .zone-modal-box.pet {
  width: min(96vw, 1180px) !important;
  max-width: none !important;
  max-height: 92vh !important;
  height: auto !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

#petModal .modal-header {
  flex: 0 0 auto;
}

#petModal .zone-modal-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  padding: 10px 14px 0 !important;
}

#petModal #petInfoView {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  width: 100% !important;
  gap: 8px !important;
}

#petModal .pet-three-col {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  gap: 12px !important;
}

#petColDetail,
#petColAbility {
  min-height: 0 !important;
  max-height: none !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-right: 2px;
}

/* ---------- 2. 宠物栏：卡片不再被拉成长条，空位只留 1 个 ---------- */
#petColList .pet-team-panel {
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
  padding: 0 !important;
}

#petColList .panel-heading {
  margin: 0 0 6px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

#petColList .panel-heading h2 {
  font-size: 13px !important;
  letter-spacing: .02em;
  color: var(--p-muted) !important;
  font-weight: 700 !important;
}

/* 分页条：贴到标题右侧 */
#petColList .pet-team-pager {
  margin: 0 0 8px !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  min-height: 0 !important;
}

#petColList .pet-team-pager-info {
  font-size: 12px !important;
  color: var(--p-muted) !important;
  gap: 10px !important;
}

#petColList .pet-page-btn {
  width: 26px !important;
  height: 26px !important;
  border-radius: 9px !important;
}

#petColList .pet-page-dot {
  min-width: 26px !important;
  height: 26px !important;
  border-radius: 9px !important;
  font-size: 12px !important;
}

#petColList .pet-team-list {
  gap: 10px !important;
  overflow: visible !important;
  padding: 2px 0 4px !important;
}

/* 卡片按固定宽度排列，剩余空间留白，不再拉伸 */
#petColList .pet-team-item {
  position: relative !important;
  flex: 0 0 168px !important;
  max-width: 168px !important;
  height: 104px !important;
  padding: 10px 6px 8px !important;
  border-radius: 16px !important;
  border: 1.5px solid var(--p-line) !important;
  background: linear-gradient(180deg, #fffdf8, #fbf4e6) !important;
  box-shadow: 0 2px 0 rgba(205, 187, 156, .55) !important;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease !important;
}

#petColList .pet-team-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(120, 96, 52, .16) !important;
  border-color: #e0c68d !important;
}

/* 出战宠：金边 + 左上角「出战中」角标，一眼可辨 */
#petColList .pet-team-item.active {
  border-color: var(--p-gold) !important;
  box-shadow: 0 0 0 2px rgba(196, 138, 38, .22), 0 6px 16px rgba(196, 138, 38, .18) !important;
  background: linear-gradient(180deg, #fffaf0, #fdf0d6) !important;
}

#petColList .pet-team-item.active::after {
  content: "出战中";
  position: absolute;
  top: -7px;
  left: 8px;
  padding: 1px 7px;
  font-size: 10px;
  line-height: 16px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(180deg, #e0a63a, #c48a26);
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(196, 138, 38, .35);
}

/* 空位：只保留 1 个当「还能再收」的提示，其余隐藏 */
#petColList .pet-team-item.is-empty {
  flex: 0 0 132px !important;
  max-width: 132px !important;
  min-height: 104px !important;
  border: 2px dashed #d8c9ab !important;
  background: rgba(255, 253, 248, .45) !important;
  box-shadow: none !important;
}

#petColList .pet-team-item.is-empty ~ .pet-team-item.is-empty {
  display: none !important;
}

#petColList .pet-team-item.is-empty::before {
  content: "＋";
  font-size: 18px;
  color: #bfa882;
  line-height: 1;
}

#petColList .pet-team-img {
  width: 46px !important;
  height: 46px !important;
}

#petColList .pet-team-name {
  font-size: 13px !important;
  font-weight: 800 !important;
}

#petColList .pet-team-level {
  font-size: 11px !important;
}

/* ---------- 3. 概览：立绘占满、去掉大片空白、加柔光底座 ---------- */
#hatchPanel {
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  height: 100% !important;
}

#hatchPanel .panel-heading {
  flex: 0 0 auto;
  margin: 0 0 4px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

#hatchPanel .panel-heading h2 {
  font-size: 13px !important;
  color: var(--p-muted) !important;
  font-weight: 700 !important;
}

#hatchContent.hatch-content {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 0 !important;
}

#hatchContent .pet-card {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  width: 100% !important;
  max-width: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 22px !important;
  padding: 14px 12px 62px !important;
  background:
    radial-gradient(120% 80% at 50% 18%, rgba(255, 255, 255, .95), rgba(255, 246, 226, .9) 45%, rgba(244, 230, 203, .95) 100%) !important;
  box-shadow: inset 0 0 0 1px rgba(196, 138, 38, .14), 0 10px 26px rgba(120, 96, 52, .08) !important;
}

#hatchContent .pet-card img,
#hatchContent img.pet-avatar {
  width: auto !important;
  height: 76% !important;
  max-height: 340px !important;
  object-fit: contain !important;
  image-rendering: auto;
  filter: drop-shadow(0 12px 20px rgba(90, 70, 30, .18));
}

/* 名字/进化信息做成压在立绘底部的「铭牌」，立绘可以铺满整张卡 */
#hatchContent .hatch-copy {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  flex: 0 0 auto;
  width: auto !important;
  max-width: calc(100% - 24px) !important;
  text-align: center !important;
  padding: 7px 18px !important;
  border-radius: 999px;
  background: rgba(255, 253, 248, .9);
  box-shadow: 0 6px 18px rgba(120, 96, 52, .16), inset 0 0 0 1px rgba(196, 138, 38, .18);
  backdrop-filter: blur(4px);
}

#hatchContent.hatch-content {
  position: relative;
}

#hatchContent .hatch-copy h3 {
  font-size: 15px !important;
  margin: 0 !important;
  white-space: nowrap;
}

#hatchContent .pet-evolve-line {
  font-size: 11.5px !important;
  color: var(--p-muted) !important;
  margin: 2px 0 0 !important;
  white-space: nowrap;
}

/* 蛋态也居中好看一点 */
#hatchContent .egg-visual {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 4. 属性栏：标题降噪、三围更紧凑、克制关系上移 ---------- */
#petColAbility .pet-tabs {
  position: sticky !important;
  top: 0;
  z-index: 3;
  display: flex !important;
  gap: 8px !important;
  padding: 0 0 6px !important;
  background: linear-gradient(180deg, #fffdfa 72%, rgba(255, 253, 250, 0)) !important;
}

#petColAbility .pet-tabs .role-tab {
  flex: 1 1 0 !important;
  height: 34px !important;
  white-space: nowrap !important;
  font-size: 13px !important;
  border-radius: 12px !important;
}

#petColAbility .stat-panel {
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
}

#petColAbility .stat-panel .panel-heading {
  margin: 0 0 6px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

#petColAbility .stat-panel .panel-heading h2 {
  font-size: 13px !important;
  color: var(--p-muted) !important;
  font-weight: 700 !important;
}

#petColAbility .power-score {
  font-size: 12px !important;
  padding: 3px 10px !important;
}

#petColAbility .power-score strong {
  font-size: 16px !important;
}

#petColAbility .battle-stats {
  gap: 8px !important;
}

#petColAbility .battle-stat {
  padding: 8px 4px !important;
  border-radius: 14px !important;
}

#petColAbility .battle-stat strong {
  font-size: 18px !important;
}

#petColAbility .type-info {
  cursor: pointer;
  border-radius: 12px !important;
  transition: background .12s ease;
}

#petColAbility .type-info:hover {
  background: rgba(196, 138, 38, .08);
}

/* ---------- 5. 操作栏：贴底常驻、按钮等高、出战按钮最显眼 ---------- */
#petActionBar {
  flex: 0 0 auto;
  position: static;
  z-index: 5;
  width: 100% !important;
  align-self: stretch;
  margin: 8px 0 2px !important;
  padding: 12px 0 2px !important;
  background: none !important;
  border: 0 !important;
  border-top: 1px solid rgba(196, 138, 38, .16) !important;
}

/* app.js 把按钮渲染成两个 .pet-actions-row，这里拍平成一行 */
#petActionBar .pet-actions {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  width: 100% !important;
  justify-content: center !important;
  align-items: center !important;
}

#petActionBar .pet-actions-row {
  display: contents !important;
}

#petActionBar button,
#petActionBar .pet-team-active-tag,
#petActionBar .pet-act-tag {
  flex: 0 1 auto !important;
  width: auto !important;
  min-width: 128px !important;
  max-width: 240px !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 18px !important;
  font-size: 13px !important;
  border-radius: 12px !important;
  white-space: nowrap !important;
}

#petActionBar .pet-team-active-tag,
#petActionBar .pet-act-tag {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* 禁用态说清原因，别只靠 title */
#petActionBar button.pet-act-btn:disabled {
  opacity: .55 !important;
  cursor: not-allowed !important;
  background: #f3ece0 !important;
  color: #9b8c74 !important;
  box-shadow: none !important;
}

/* 矮屏（1366×768 笔记本）压缩属性栏，避免最后一行被切一半 */
@media (max-height: 800px) and (min-width: 981px) {
  #petColAbility .battle-stats { gap: 8px !important; }
  #petColAbility .battle-stat { padding: 7px 6px !important; min-height: 0 !important; }
  #petColAbility .battle-stat .battle-stat-label { font-size: 11px !important; }
  #petColAbility .battle-stat .battle-stat-value { font-size: 17px !important; }
  #petColAbility .stat-bars { gap: 5px !important; }
  #petColAbility { padding-bottom: 4px; }
}

/* ---------- 6. 窄屏 / 手机：单列 + 横向滑动的宠物栏 ---------- */@media (max-width: 1200px) {
  #petColList .pet-team-item {
    flex: 0 0 146px !important;
    max-width: 146px !important;
  }
}

@media (max-width: 980px) {
  #petModal .zone-modal-box.pet {
    width: min(98vw, 760px) !important;
    max-height: 94vh !important;
  }

  #petModal .pet-three-col {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto auto auto !important;
    overflow-y: auto !important;
    padding-right: 2px;
  }

  #petColList {
    grid-column: 1 !important;
    grid-row: 1 !important;
    overflow: visible !important;
  }

  #petColDetail {
    grid-column: 1 !important;
    grid-row: 2 !important;
    overflow: visible !important;
    min-height: 340px !important;
  }

  #petColAbility {
    grid-column: 1 !important;
    grid-row: 3 !important;
    overflow: visible !important;
  }

  #petColList .pet-team-list {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding-bottom: 8px !important;
    -webkit-overflow-scrolling: touch;
  }

  #petColList .pet-team-item {
    flex: 0 0 104px !important;
    max-width: 104px !important;
  }

  #petColList .pet-team-item.is-empty {
    flex: 0 0 96px !important;
    max-width: 96px !important;
  }

  /* 手机上立绘区别拉满整屏，给属性和按钮留位置 */
  #hatchPanel {
    height: auto !important;
  }

  #hatchContent .pet-card {
    flex: 0 0 auto !important;
    min-height: 226px !important;
    max-height: 262px !important;
    padding: 10px 10px 76px !important;
  }

  #hatchContent .pet-card img,
  #hatchContent img.pet-avatar {
    height: auto !important;
    max-height: 172px !important;
    max-width: 72% !important;
  }

  #hatchContent .hatch-copy {
    padding: 6px 14px !important;
  }

  #hatchContent .hatch-copy h3 {
    font-size: 13px !important;
    white-space: normal !important;
  }

  #hatchContent .pet-evolve-line {
    font-size: 11px !important;
    white-space: normal !important;
  }
}

@media (max-width: 520px) {
  #petModal .zone-modal-box.pet {
    width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
  }

  #petModal .zone-modal-body {
    padding: 8px 10px 0 !important;
  }

  #petActionBar {
    margin: 0 -10px !important;
    padding: 8px 10px 10px !important;
  }

  #petColList .pet-team-item {
    flex: 0 0 88px !important;
    max-width: 88px !important;
    height: 96px !important;
  }

  #petColList .pet-team-name {
    font-size: 12px !important;
  }

  #petActionBar button.pet-act-btn {
    min-width: 0 !important;
    flex: 1 1 46% !important;
    font-size: 12px !important;
    height: 36px !important;
  }

  #petColDetail {
    min-height: 300px !important;
  }
}

/* ---------- 7. 动效克制：减少无谓动画 ---------- */
@media (prefers-reduced-motion: reduce) {
  #petColList .pet-team-item,
  #petColAbility .type-info {
    transition: none !important;
  }
}




/* ---------- 8. 快捷操作：搜索定位 / 排序跳转 / 键盘选中 ---------- */
#petColList .pet-quick-bar {
  display: flex;
  gap: 8px;
  margin: 0 0 8px;
  align-items: center;
}

#petColList .pet-quick-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(196, 138, 38, .28);
  border-radius: 10px;
  background: #fffdf7;
  color: #4a3a22;
  font-size: 12px;
  transition: border-color .15s, box-shadow .15s;
}

#petColList .pet-quick-input::placeholder { color: #b2a184; }

#petColList .pet-quick-input:focus {
  outline: none;
  border-color: #e0a83c;
  box-shadow: 0 0 0 3px rgba(224, 168, 60, .16);
}

#petColList .pet-quick-input.is-miss {
  border-color: #e06a5a;
  box-shadow: 0 0 0 3px rgba(224, 106, 90, .15);
}

#petColList .pet-quick-select {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 6px;
  border: 1px solid rgba(196, 138, 38, .28);
  border-radius: 10px;
  background: #fffdf7;
  color: #6d5a3c;
  font-size: 12px;
}

#petColList .pet-quick-select:focus { outline: none; border-color: #e0a83c; }

#petColList .pet-team-item.is-search-hit {
  animation: petHitPulse 1.1s ease-out 2;
  box-shadow: 0 0 0 3px #f0a92e, 0 6px 14px rgba(240, 169, 46, .35) !important;
}

#petColList .pet-team-item.is-kb-focus {
  box-shadow: 0 0 0 3px rgba(58, 143, 74, .55) !important;
}

@keyframes petHitPulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@media (max-width: 520px) {
  #petColList .pet-quick-input { height: 28px; font-size: 11px; }
  #petColList .pet-quick-select { height: 28px; font-size: 11px; max-width: 96px; }
}
