/* =========================================================
   relic.css —— 首页「陆 · 宝物图鉴」整屏（在 codex.css 之后、deck.css 之前加载）
   六档稀有度 × 253 件，切换档位只重画格子；格子本身可滚（data-deck-scroll，
   deck.js 不会把滚轮当成翻页）。
   ========================================================= */

.relic .section-shell { position: relative; z-index: 2; }

/* ---- 头部 ---- */
.relic-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 36px;
  margin-bottom: 18px;
}
.relic-lead .eyebrow { margin: 0 0 10px; }
.relic-lead .eyebrow span {
  color: var(--ember-light);
  font-family: Georgia, serif;
  font-size: 12px;
  letter-spacing: .22em;
  margin-left: 2px;
}
.relic-lead h3 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: .14em;
  line-height: 1.1;
  margin: 0;
  color: #EDE7DA;
}
.relic-lead h3 em {
  font-family: Georgia, serif;
  font-style: normal;
  font-size: 16px;
  letter-spacing: .18em;
  margin-left: 12px;
  vertical-align: 6px;
  color: rgb(var(--accent));
  transition: color .3s;
}
.relic-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin: 8px 0 0;
  color: #938F86;
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: .1em;
}
/* 只抽 4 排这件事得说明白，否则「怎么才这么点」 */
.relic-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-style: normal;
  font-size: 12.5px;
  letter-spacing: .1em;
  color: #7B8280;
}
.relic-hint:before {
  content: "";
  width: 4px;
  height: 4px;
  border: 1px solid rgba(196,176,137,.45);
  transform: rotate(45deg);
}

/* ---- 档位切换：字母标 + 件数，激活时整条成稀有度色 ---- */
.relic-tiers { display: flex; gap: 4px; flex-shrink: 0; }
.relic-tier {
  position: relative;
  border: 0;
  border-bottom: 1px solid rgba(196,176,137,.14);
  background: transparent;
  padding: 4px 14px 10px;
  cursor: pointer;
  text-align: center;
  transition: border-color .25s;
}
.relic-tier span {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  letter-spacing: .1em;
  color: #6E6A64;
  transition: color .25s, text-shadow .25s;
}
.relic-tier small {
  display: block;
  font-size: 10.5px;
  letter-spacing: .1em;
  color: #4C5253;
  margin-top: 3px;
  transition: color .25s;
}
.relic-tier:hover span { color: #B9B2A4; }
.relic-tier:after {
  content: "";
  position: absolute;
  left: 50%;
  right: 50%;
  bottom: -1px;
  height: 1px;
  background: rgb(var(--accent));
  transition: left .25s, right .25s;
}
.relic-tier.is-active span {
  color: rgb(var(--accent));
  text-shadow: 0 0 18px rgba(var(--accent), .55);
}
.relic-tier.is-active small { color: #8A8579; }
.relic-tier.is-active:after { left: 10%; right: 10%; box-shadow: 0 0 12px rgba(var(--accent), .6); }

/* ---- 可滚动的宝物格 ---- */
.relic-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: #2C3338 transparent;
}
.relic-body::-webkit-scrollbar { width: 6px; }
.relic-body::-webkit-scrollbar-track { background: transparent; }
.relic-body::-webkit-scrollbar-thumb { background: #2A3136; border: 0; }

.relic-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}
.relic-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 156px;
  padding: 13px 8px 10px;
  border: 1px solid rgba(196,176,137,.13);
  background:
    radial-gradient(ellipse at 50% 24%, rgba(var(--accent), .12), transparent 66%),
    linear-gradient(180deg, rgba(16,20,25,.62), rgba(8,11,14,.84));
  transition: border-color .28s, background .28s, transform .28s;
  overflow: hidden;
  /* 格子是 <button>：撤掉浏览器给的按钮外观 */
  appearance: none;
  -webkit-appearance: none;
  border-radius: 0;
  font: inherit;
  color: inherit;
  text-align: center;
  cursor: pointer;
}
.relic-card:hover {
  border-color: rgba(var(--accent), .5);
  transform: translateY(-2px);
  background:
    radial-gradient(ellipse at 50% 24%, rgba(var(--accent), .24), transparent 70%),
    linear-gradient(180deg, rgba(19,24,29,.72), rgba(9,12,15,.9));
}
.relic-art {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
}
.relic-card img {
  /* 绝对定位填满 .relic-art：百分比高度只有对着"尺寸确定的定位祖先"才算得准，
     直接写 height:100% 在弹性项里会退回原始尺寸，图标就会顶出卡片被裁掉。
     inset:0 + margin:auto 让封顶之后仍然居中。 */
  position: absolute;
  inset: 0;
  margin: auto;
  width: 100%;
  height: 100%;
  max-width: 96px;
  max-height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.72)) brightness(1.04);
  transition: transform .3s cubic-bezier(.22,.61,.36,1), filter .3s;
}
.relic-card:hover img { transform: scale(1.06); filter: drop-shadow(0 8px 16px rgba(0,0,0,.8)) brightness(1.1); }
.relic-card b {
  margin-top: 8px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: .01em;
  color: #DCD6C7;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-wrap: balance; /* 两行时均分，别留一个字孤零零挂在第二行 */
  transition: color .28s;
}
.relic-card:hover b { color: #F0EBDF; }

/* 档位切换的淡入 */
.relic-grid.is-swap .relic-card {
  animation: relicCardIn .4s cubic-bezier(.22,.61,.36,1) backwards;
}
@keyframes relicCardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
html.deck-nofx .relic-grid.is-swap .relic-card { animation: none; }

/* ---- 分页模式：格子区吃掉剩余高度，自己滚 ---- */
/* 能滚的时候在底部压一层渐隐，避免卡片被硬切一半 */
@media (min-width: 1024px) {
  html.deck-mode .relic-body.is-scroll {
    -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 34px), transparent 100%);
    mask-image: linear-gradient(180deg, #000 calc(100% - 34px), transparent 100%);
  }
  html.deck-mode .relic .section-shell {
    display: flex;
    flex-direction: column;
    height: calc(100svh - 168px);
  }
  html.deck-mode .relic-body { flex: 1; min-height: 0; }
  /* 只抽 4 排，就让这 4 排把面板吃满：行高由容器算，卡高不再写死 */
  html.deck-mode .relic-grid {
    height: 100%;
    /* 排数由 JS 按面板高度算好写进 --relic-rows（最多 4） */
    grid-template-rows: repeat(var(--relic-rows, 4), minmax(0, 1fr));
  }
  html.deck-mode .relic-card { height: auto; }
}

@media (min-width: 1024px) and (max-width: 1279px) {
  .relic-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; }
  .relic-lead h3 { font-size: 26px; }
  .relic-tier { padding: 4px 10px 10px; }
  .relic-tier span { font-size: 15.5px; }
  .relic-card { height: 146px; padding: 11px 6px 9px; }
  .relic-card b { font-size: 15px; }
}

/* ---- 流式（<1024 不分页，格子不限高、不内滚） ---- */
@media (max-width: 1023px) {
  .relic-top { flex-direction: column; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
  .relic-tiers { width: 100%; overflow-x: auto; gap: 2px; }
  .relic-tier { padding: 4px 11px 9px; }
  .relic-body { overflow: visible; padding-right: 0; }
  .relic-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
  .relic-card { height: 136px; padding: 10px 6px 9px; }
  .relic-card b { font-size: 15px; }
}
@media (max-width: 700px) {
  .relic-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .relic-card { height: 126px; }
  .relic-card b { font-size: 14px; }
  .relic-lead h3 { font-size: 25px; }
}
