/* dex.css - 图鉴页（dex.html）
 * 设计语言与设计稿 dex-b-grid / dex-d-detail 一致：浅色纸底、3px 墨描边、硬阴影、胶囊标签
 */

:root {
  --ink: #1d1d1d;
  --paper: #FFF9EF;
  --miku: #39C5BB;
  --yellow: #FFD93D;
  --locked-bg: #EFEDE7;
  --locked-ink: #8f8b82;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "YouYuan", "Yuanti SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--paper);
  color: var(--ink);
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

/* ===== 顶栏：返回 + 标题 + 已收集计数 ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 6px;
}

.back {
  width: 44px;
  height: 44px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  color: var(--ink);
}

.topbar h1 {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 4px;
}

.progress {
  margin-left: auto;
  padding: 5px 13px;
  background: var(--miku);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

/* 布置主页入口（顶栏下一行，靠右） */
.arrange-entry-row {
  display: flex;
  justify-content: flex-end;
  padding: 2px 14px 0;
}

.arrange-entry {
  min-height: 44px;
  padding: 8px 18px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
}

.arrange-entry:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

/* ===== 分页 Tab ===== */
.tabs {
  display: flex;
  gap: 10px;
  padding: 8px 14px 4px;
}

.tab {
  flex: 1;
  min-height: 44px;
  padding: 9px 0;
  background: #fff;
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 999px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 2px;
  font-family: inherit;
  cursor: pointer;
}

.tab.active {
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--ink);
}

/* ===== 状态图例 ===== */
.legend {
  display: flex;
  gap: 6px;
  padding: 6px 14px 2px;
  flex-wrap: wrap;
}

.lg {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.lg-ok   { background: #D9F4F2; border: 2px solid var(--ink); }
.lg-lock { background: var(--locked-bg); border: 2px solid #B9B5AA; color: var(--locked-ink); }
.lg-soon { background: #fff; border: 2px dashed #B9B5AA; color: var(--locked-ink); }

/* ===== 网格：一排 3 列 ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px 12px 20px;
}

.cell {
  position: relative;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 14px 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.cell:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

.ic {
  width: 100%;
  max-width: 106px;
  aspect-ratio: 1;
  background: var(--tbg, #EAF7F5);
  border: 2px solid var(--ink);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.ic img {
  max-width: 90%;
  max-height: 90%;
  display: block;
}

.nm {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  line-height: 1.25;
}

.au {
  margin-top: 1px;
  font-size: 9px;
  font-weight: 800;
  color: #7c7668;
}

/* 已解锁 ·「展示中」角标 */
.onhome {
  position: absolute;
  top: -8px;
  left: -6px;
  z-index: 2;
  padding: 2px 8px;
  background: var(--miku);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
}

/* ===== 未解锁：灰剪影 + 🔒 ===== */
.cell.locked {
  background: var(--locked-bg);
  border-color: #B9B5AA;
  box-shadow: 4px 4px 0 #C9C5BA;
}

.cell.locked .ic {
  background: #E4E1D9;
  border-color: #B9B5AA;
}

.cell.locked .ic img {
  filter: brightness(0);
  opacity: 0.25;
}

.cell.locked .nm { color: #6f6b61; }
.cell.locked .au { color: #a09b8f; }

.lock-badge {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 26px;
  height: 26px;
  background: #fff;
  border: 2px solid #B9B5AA;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

/* ===== 敬请期待：虚线灰卡，无锁 ===== */
.cell.soon {
  background: #F6F5F1;
  border-style: dashed;
  border-color: #B9B5AA;
  box-shadow: none;
}

.cell.soon .ic {
  background: #ECEAE3;
  border-style: dashed;
  border-color: #B9B5AA;
}

/* 有正式图的敬请期待条目（妙脆角猫）：灰显示意 */
.cell.soon .ic img {
  filter: grayscale(1);
  opacity: 0.22;
}

.cell.soon .nm { color: #8f8b82; }

.qmark {
  font-size: 34px;
  font-weight: 900;
  color: #C9C5BA;
}

.soon-txt {
  margin-top: 1px;
  font-size: 9px;
  font-weight: 900;
  color: #a09b8f;
}

/* 页底：解锁条件速查 */
.footnote {
  margin: 0 12px 18px;
  padding: 8px 12px;
  background: #fff;
  border: 2px dashed #B9B5AA;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 800;
  color: #8f8b82;
  line-height: 1.7;
}

.hidden { display: none; }

/* ==================== 详情弹层 ==================== */
.dex-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(29, 29, 29, 0.45);
}

.dex-overlay[hidden] { display: none; }

.sheet {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 41;
  transform: translate(-50%, -50%);
  width: min(400px, calc(100vw - 48px));
  max-height: calc(100vh - 96px);
  max-height: calc(100dvh - 96px);
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 22px;
  box-shadow: 6px 6px 0 var(--ink);
  overflow: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sheet[hidden] { display: none; }

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--yellow);
  border-bottom: 3px solid var(--ink);
  flex: none;
}

.sheet-head .ttl {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 2px;
}

.sheet-close {
  width: 44px;
  height: 44px;
  margin: -6px -6px -6px 0;   /* 视觉居中，触控目标保持 44×44 */
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 50%;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  flex: none;
}

/* 大图区 */
.big {
  height: 190px;
  background: var(--tbg, #DFF5F2);
  border-bottom: 3px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex: none;
}

.big img {
  max-height: 160px;
  max-width: 70%;
  display: block;
}

.big .qmark-big {
  font-size: 64px;
  font-weight: 900;
  color: #C9C5BA;
}

.state-chip {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 12px;
  background: var(--miku);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.move-chip {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 12px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

/* 名称 + 署名 */
.id-block {
  padding: 12px 16px 10px;
  border-bottom: 3px dashed #E4E1D9;
  flex: none;
}

.id-block h2 {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 1px;
}

.author-band {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  background: #EDE4FF;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
}

/* 信息分区 */
.info {
  padding: 10px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex: none;
}

.info .cell {
  padding: 6px 10px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px;
  cursor: default;
  box-shadow: none;
  flex-direction: column;
  align-items: flex-start;
}

.info .k {
  font-size: 9px;
  font-weight: 900;
  color: #9a9382;
  letter-spacing: 1px;
}

.info .v {
  margin-top: 1px;
  font-size: 13px;
  font-weight: 900;
}

.info .v small {
  font-size: 10px;
  color: #7c7668;
  font-weight: 800;
}

/* 解锁状态行 */
.unlock-row {
  margin: 0 16px 12px;
  padding: 7px 12px;
  background: #D9F4F2;
  border: 2px solid var(--ink);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 900;
  flex: none;
}

/* 主按钮 */
.cta {
  margin: 0 16px 16px;
  min-height: 52px;
  padding: 12px 0;
  background: var(--yellow);
  color: var(--ink);
  border: 4px solid var(--ink);
  border-radius: 999px;
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 4px;
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  flex: none;
}

.cta:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

/* 未解锁态（sheet.locked 时切换） */
.sheet.locked .big { background: #E4E1D9; }
.sheet.locked .big img { filter: brightness(0); opacity: 0.25; }
.sheet.locked .state-chip { background: #B9B5AA; }
.sheet.locked .unlock-row {
  background: var(--locked-bg);
  border-color: #B9B5AA;
  color: var(--locked-ink);
}

.sheet.locked .cta {
  background: var(--locked-bg);
  color: var(--locked-ink);
  border-color: #B9B5AA;
  box-shadow: 4px 4px 0 #C9C5BA;
  letter-spacing: 0;
  font-size: 13px;
  cursor: default;
}

.sheet.locked .cta:active {
  transform: none;
  box-shadow: 4px 4px 0 #C9C5BA;
}

.lock-big {
  display: none;
  position: absolute;
  right: 14px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  background: #fff;
  border: 2px solid #B9B5AA;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.sheet.locked .lock-big { display: flex; }

/* 敬请期待态 */
.sheet.soon .state-chip { background: #B9B5AA; }
.sheet.soon .unlock-row {
  background: #F6F5F1;
  border-style: dashed;
  border-color: #B9B5AA;
  color: var(--locked-ink);
}

/* 矮屏：大图区压缩，保证按钮可见 */
@media (max-height: 640px) {
  .big { height: 140px; }
  .big img { max-height: 116px; }
  .id-block { padding: 8px 16px 8px; }
  .id-block h2 { font-size: 20px; }
}
