:root {
  --bg: #12070a;
  --panel: rgba(36, 14, 18, 0.92);
  --gold: #f0c14a;
  --gold-dim: rgba(240, 193, 74, 0.16);
  --cream: #f6ead0;
  --muted: #b7a48c;
  --line: rgba(240, 193, 74, 0.28);
  --common: #49a6ff;
  --uncommon: #3dcc8e;
  --rare: #ff5f55;
  --legendary: #d392ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  color: var(--cream);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1100px 520px at 50% -8%, rgba(176, 42, 48, 0.55), transparent 62%),
    radial-gradient(700px 480px at 110% 110%, rgba(92, 24, 36, 0.55), transparent 55%),
    linear-gradient(180deg, #1a0b10 0%, #12070a 40%, #0c0608 100%);
}

button, input { font: inherit; color: inherit; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 22px 28px 16px;
  background: rgba(18, 7, 10, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand { max-width: 920px; }

.eyebrow {
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.22em;
  font-size: 12px;
  text-transform: uppercase;
}

h1 {
  margin: 4px 0 0;
  font-size: 40px;
  font-weight: 760;
  letter-spacing: 0.04em;
}

.lede {
  margin: 6px 0 0;
  color: var(--muted);
}

.tools { margin-top: 16px; }

[hidden] { display: none !important; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--cream);
  font-weight: 620;
  cursor: pointer;
}

.tab:hover { border-color: var(--gold); }

.tab.is-on {
  border-color: var(--gold);
  color: var(--gold);
  background: linear-gradient(180deg, rgba(240, 193, 74, 0.22), rgba(240, 193, 74, 0.08));
}

.tab .n {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.tab.is-on .n { background: var(--gold); color: #2a1608; }

.search input {
  width: min(460px, 100%);
  padding: 11px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  outline: none;
}

.search input:focus { border-color: var(--gold); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.chip {
  border: 1px solid rgba(246, 234, 208, 0.18);
  background: transparent;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--cream);
}

.chip:hover { border-color: var(--gold); }

.chip.is-on {
  background: var(--gold);
  color: #2a1608;
  border-color: var(--gold);
  font-weight: 650;
}

.chip:focus-visible,
button:focus-visible,
.search input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.sep {
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 4px;
}

.count {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

main { padding: 22px 28px 40px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 16px;
}

/* 收藏页顶部的说明面板要占满整行 */
.grid > .panel { grid-column: 1 / -1; }

.tile-wrap { position: relative; display: flex; }

.tile-wrap .tile { flex: 1; min-width: 0; }

.fav-star {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(240, 193, 74, 0.45);
  border-radius: 999px;
  background: rgba(18, 7, 10, 0.78);
  color: var(--gold);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s, transform 0.15s;
}

.tile-wrap:hover .fav-star,
.fav-star:focus-visible { opacity: 1; }

.fav-star.is-on {
  opacity: 1;
  background: var(--gold);
  color: #2a1608;
  border-color: var(--gold);
}

.fav-star:hover { transform: scale(1.08); }

.tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
  cursor: pointer;
}

.tile:hover,
.tile:focus-visible {
  border-color: var(--line);
  background: rgba(240, 193, 74, 0.06);
}

.face-wrap { position: relative; }

.face {
  width: 100%;
  height: auto;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #f3efe4;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.price-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(240, 193, 74, 0.55);
  background: rgba(18, 7, 10, 0.84);
  color: var(--gold);
  font-size: 11.5px;
  font-weight: 650;
  pointer-events: none;
}

.name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.name {
  font-weight: 680;
  font-size: 15px;
}

.rarity {
  font-size: 12px;
  white-space: nowrap;
}

.rarity.common { color: var(--common); }
.rarity.uncommon { color: var(--uncommon); }
.rarity.rare { color: var(--rare); }
.rarity.legendary { color: var(--legendary); }
.rarity.kind { color: var(--muted); }

.how {
  margin: 0;
  min-height: 3.5em;
  color: var(--gold);
  font-size: 12.5px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.how.quiet { color: var(--muted); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 0;
}

.foot {
  padding: 0 28px 36px;
  color: var(--muted);
  font-size: 12px;
}

dialog {
  width: min(920px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #241016;
  color: var(--cream);
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgba(0, 0, 0, 0.72); }

.detail {
  position: relative;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 8px 28px;
  padding: 26px;
  overflow: auto;
  max-height: calc(100vh - 24px);
}

.detail-art img {
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #f3efe4;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.pager {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.pager button,
.close {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
}

.pager button:hover,
.close:hover { border-color: var(--gold); }

.detail-body { position: relative; min-width: 0; }

.detail-actions {
  position: absolute;
  top: 26px;
  right: 26px;
  z-index: 2;
  display: flex;
  gap: 8px;
}

.close { position: static; }

.fav-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: transparent;
  color: var(--cream);
  cursor: pointer;
  white-space: nowrap;
}

.fav-btn:hover { border-color: var(--gold); }

.fav-btn.is-on {
  border-color: var(--gold);
  background: rgba(240, 193, 74, 0.16);
  color: var(--gold);
  font-weight: 650;
}

.d-order {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.detail-body h2 {
  margin: 4px 160px 0 0;
  font-size: 32px;
}

.d-en {
  margin: 2px 0 12px;
  color: var(--muted);
}

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

.pill {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pill.common { color: var(--common); }
.pill.uncommon { color: var(--uncommon); }
.pill.rare { color: var(--rare); }
.pill.legendary { color: var(--legendary); }
.pill.sell { color: var(--gold); border-color: rgba(240, 193, 74, 0.4); }

.detail-body section { margin: 0 0 14px; }

.detail-body h3 {
  margin: 0 0 6px;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 650;
}

.detail-body p { margin: 0; line-height: 1.6; }

.unlock-box {
  background: var(--gold-dim);
  border: 1px solid rgba(240, 193, 74, 0.5);
  border-radius: 12px;
  padding: 12px 14px;
}

.unlock-box h3 { color: var(--gold); }

.hint {
  margin-top: 8px !important;
  color: var(--muted);
  font-size: 12px;
}

/* ---------------------------------------------------------- 组合打法 */

.grid.is-combos { display: block; }

.combo {
  padding: 20px 22px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  /* 顶部工具栏是 sticky 的，锚点跳转要给它让位，实际高度由 JS 同步 */
  scroll-margin-top: calc(var(--header-h, 250px) + 14px);
}

.combo-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.combo-head h2 { margin: 0; font-size: 24px; }

.combo-en {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.combo-badges { display: flex; gap: 8px; }

.badge {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}

.badge.tier { font-weight: 700; }
.badge.tier-s { color: var(--rare); border-color: rgba(255, 95, 85, 0.5); }
.badge.tier-a { color: var(--gold); border-color: rgba(240, 193, 74, 0.5); }
.badge.tier-b { color: var(--common); border-color: rgba(73, 166, 255, 0.4); }

.combo-summary { margin: 10px 0 0; line-height: 1.65; }

.combo-section { margin-top: 16px; }

.combo-section h3 {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 650;
}

.combo-cards { display: flex; flex-wrap: wrap; gap: 10px; }

.combo-card {
  width: 92px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(240, 193, 74, 0.07);
  color: var(--cream);
  cursor: pointer;
}

.combo-card:hover { border-color: var(--gold); }

.combo-card img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.combo-card span { font-size: 12px; text-align: center; }

.combo-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.combo-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 5px;
  border: 1px solid rgba(246, 234, 208, 0.18);
  border-radius: 999px;
  background: transparent;
  color: var(--cream);
  font-size: 13px;
  cursor: pointer;
}

.combo-chip:hover { border-color: var(--gold); }

.combo-chip img {
  width: 22px;
  height: 30px;
  border-radius: 4px;
  background: #f3efe4;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.combo-steps { margin: 0; padding-left: 22px; line-height: 1.75; }

.combo-steps li { margin-bottom: 4px; }

.combo-notes {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(240, 193, 74, 0.35);
  border-radius: 12px;
  background: var(--gold-dim);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.combo-notes strong { color: var(--gold); }

.combo-links { display: flex; flex-wrap: wrap; gap: 8px; }

.role-pill {
  margin-left: 6px;
  padding: 2px 9px;
  border: 1px solid rgba(240, 193, 74, 0.45);
  border-radius: 999px;
  background: rgba(240, 193, 74, 0.12);
  color: var(--gold);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0;
  vertical-align: 2px;
}

#d-guide { line-height: 1.75; }

.partner-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.partner-label { color: var(--muted); font-size: 12.5px; }

/* ---------------------------------------------------------- 牌组与注 */

.panel {
  padding: 20px 22px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(240, 193, 74, 0.05);
}

.panel h2 { margin: 0 0 8px; font-size: 22px; }

.panel-note {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.stake-list { display: flex; flex-direction: column; gap: 8px; }

.stake-row {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.stake-name {
  color: var(--gold);
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
}

.stake-name em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 400;
}

.stake-body { min-width: 0; }

.stake-tip { font-size: 13.5px; line-height: 1.65; }

.stake-tip strong { color: var(--gold); font-weight: 600; }

.stake-cards-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.stake-cards-label { color: var(--muted); font-size: 12px; }

/* 正文里的卡牌引用：直接显示牌面，悬停看名字与效果 */
.card-inline {
  display: inline-block;
  width: 26px;
  height: 35px;
  padding: 0;
  margin: 0 2px;
  border: 1px solid rgba(246, 234, 208, 0.35);
  border-radius: 5px;
  background: #f3efe4;
  vertical-align: -11px;
  cursor: pointer;
  overflow: hidden;
}

.card-inline img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.card-inline:hover,
.card-inline:focus-visible {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.deck-body {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 22px;
  margin-top: 14px;
}

.deck-art {
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: #f3efe4;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.deck-main { min-width: 0; }

.deck-effect { margin: 8px 0 0; line-height: 1.7; }

.deck-effect strong { color: var(--muted); font-weight: 650; }

.combo-link {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--gold);
  font-size: 13px;
  cursor: pointer;
}

.combo-link:hover { border-color: var(--gold); background: rgba(240, 193, 74, 0.12); }

@media (max-width: 720px) {
  /* ---- 顶栏压缩：原本占屏幕 63%，压到 20% 左右 ---- */
  .top, main, .foot { padding-left: 14px; padding-right: 14px; }
  .top { padding-top: 10px; padding-bottom: 8px; }
  .eyebrow, .lede { display: none; }
  h1 { margin: 0 0 8px; font-size: 22px; letter-spacing: 0.02em; }

  /* Tab 和筛选改成单行横向滑动，不再折成好几行 */
  .tabs, .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 2px;
  }

  .tabs::-webkit-scrollbar,
  .filters::-webkit-scrollbar { display: none; }

  .tabs { margin-bottom: 8px; }

  .tab {
    flex: 0 0 auto;
    padding: 7px 11px;
    font-size: 13px;
    border-radius: 10px;
  }

  .tab .n { padding: 1px 6px; font-size: 11px; }

  .search input { padding: 9px 12px; font-size: 14px; }

  .filters { margin-top: 8px; }

  .chip { flex: 0 0 auto; padding: 5px 10px; font-size: 12.5px; }

  .count { margin-top: 6px; font-size: 12px; }

  /* ---- 卡片列表适配窄屏 ---- */
  main { padding-top: 14px; padding-bottom: 32px; }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }

  .tile { padding: 8px; gap: 6px; border-radius: 12px; }
  .name { font-size: 14px; }
  .rarity { font-size: 11px; }
  .how { min-height: 0; font-size: 11.5px; -webkit-line-clamp: 2; }
  .price-badge { top: 5px; left: 5px; padding: 1px 6px; font-size: 10.5px; }
  .fav-star { top: 10px; right: 10px; width: 26px; height: 26px; font-size: 13px; }

  dialog { width: calc(100vw - 12px); max-height: calc(100dvh - 12px); border-radius: 14px; }
  .detail { grid-template-columns: 1fr; gap: 6px; padding: 12px 14px 20px; max-height: calc(100dvh - 12px); }
  .detail-actions {
    position: sticky;
    top: 0;
    margin: -12px -14px 6px;
    padding: 8px 14px;
    background: #241016;
    justify-content: flex-end;
    border-bottom: 1px solid rgba(240, 193, 74, 0.12);
  }
  .detail-art { max-width: 180px; margin: 6px auto 0; }
  .pager { justify-content: center; }
  .detail-body h2 { margin-right: 0; font-size: 26px; }
  .detail-body p, .detail-body li { line-height: 1.65; }
  .combo { padding: 16px 14px; }
  .combo-head h2 { font-size: 20px; }
  .combo-card { width: 76px; }
  .panel { padding: 16px 14px; }
  .deck-body { grid-template-columns: 1fr; }
  .deck-art { max-width: 148px; }
  .stake-row { grid-template-columns: 1fr; gap: 4px; }
}

