@font-face {
  font-family: CardText;
  src: url("assets/card-font.otf") format("opentype");
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft Yahei", sans-serif;
  color: #eee8de;
  background: #111219;
  --muted: #aaa8ae;
  --border: #35333d;
  --accent: #f2bf86;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse 68rem 32rem at 51% 0%, #302028 0%, transparent 72%); }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.shell { width: min(100% - 48px, 1376px); margin-inline: auto; }
.topbar { border-bottom: 1px solid #ffffff13; background: #13131abf; }
.topbar-inner, .results-head, .result-actions { display: flex; align-items: center; }
.topbar-inner { justify-content: space-between; min-height: 68px; gap: 16px; }
.brand-symbol { width: 25px; height: 32px; background: linear-gradient(#f7c993, #b95c4f); clip-path: polygon(50% 0, 96% 92%, 50% 75%, 4% 92%); }
.build { color: #dbc2a4; border: 1px solid #a7785860; border-radius: 20px; padding: 7px 12px; font-size: 13px; white-space: nowrap; }
.catalog-content { padding-bottom: 30px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 12px; padding: 25px 4px 18px; }
.eyebrow { margin: 0; color: #d9a87e; font-size: .75rem; font-weight: 650; letter-spacing: .17em; overflow-wrap: anywhere; }
h1 { margin: 8px 0 7px; font-size: clamp(2.45rem, 6vw, 4.1rem); letter-spacing: .035em; line-height: 1.15; }
.total { display: grid; justify-items: end; gap: 3px; min-width: 105px; padding-bottom: 3px; }
.total strong { color: #f4c696; font-size: 2.6rem; font-variant-numeric: tabular-nums; line-height: 1; }
.total span { color: #c4b7b0; font-size: .86rem; }
.filters { border: 1px solid var(--border); background: #1b1a23; border-radius: 16px; padding: 14px 16px; }
.filter-head { display: grid; align-items: end; grid-template-columns: minmax(170px, 1.8fr) repeat(4, minmax(0, 1fr)) auto; gap: 10px; }
.filter-head label { display: grid; min-width: 0; gap: 6px; color: #ccc4c4; font-size: .875rem; }
input[type="search"], select, .quiet, .pagination button, .dialog-close {
  color: #eee8de; background: #14151d; border: 1px solid #403e4a; border-radius: 8px; min-height: 42px; padding: 8px 12px;
}
input[type="search"], select { width: 100%; min-width: 0; }
input[type="search"]::placeholder { color: #9d98a3; }
select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, #b5a898 50%), linear-gradient(135deg, #b5a898 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
.quiet, .pagination button, .dialog-close { background: #292630; white-space: nowrap; }
.quiet:hover, .pagination button:not(:disabled):hover, .dialog-close:hover { border-color: #b98563; background: #3b2b30; }
.catalog-back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: .9rem; font-weight: 650; text-decoration: none; }
.catalog-back-arrow { color: var(--accent); font-size: 1.2rem; line-height: 1; }
.filter-actions { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.more-toggle, .filter-reset { min-height: 42px; border: 1px solid transparent; border-radius: 8px; color: #c4b4bd; background: transparent; padding: 0 8px; font-size: .875rem; }
.more-toggle { display: inline-flex; align-items: center; gap: 7px; border-color: #403e4a; color: #e1d4d8; background: #24212b; padding-inline: 10px; }
.more-toggle::after { content: ""; width: 5px; height: 5px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.more-toggle[aria-expanded="true"]::after { transform: translateY(2px) rotate(225deg); }
.more-toggle:hover, .more-toggle[aria-expanded="true"], .filter-reset:hover { color: #fff2dc; background: #322631; }
.filter-badge { border-radius: 5px; padding: 2px 5px; background: #4b333b; color: #f3c598; font-size: .75rem; }
.facet { display: flex; gap: 14px; align-items: baseline; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.facet > span { width: 2.2em; flex: none; font-size: .875rem; color: #ccc4c4; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { border: 1px solid #3d3945; border-radius: 7px; background: #22212b; color: #ddd4d4; font-size: .875rem; padding: 6px 10px; min-height: 33px; display: inline-flex; gap: 7px; align-items: center; }
.chip:hover { border-color: #8f736c; }
.chip[aria-pressed="true"] { background: #483139; color: #fff2dc; border-color: #be8d69; }
.swatch { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #c6c2bb; }
.swatch-red { background: #f07466; }
.swatch-green { background: #72cb8c; }
.swatch-blue { background: #69bde8; }
.swatch-orange { background: #f1a25d; }
.swatch-pink { background: #e291b4; }
.swatch-yellow { background: #e8ca73; }
.swatch-other { background: #9e99a9; }
.results { margin-top: 24px; }
.results-head { justify-content: space-between; gap: 12px; padding: 0 4px 12px; }
h2 { margin: 0; font-size: 1.35rem; }
.results-head p { margin: 4px 0 0; color: var(--muted); font-size: .875rem; }
.result-actions { gap: 12px; }
.switch { display: inline-flex; align-items: center; gap: 7px; color: #dfd5cd; white-space: nowrap; font-size: .875rem; }
.switch input { width: 16px; height: 16px; accent-color: #df9c6c; margin: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 12px; }
.card-tile { background: #191920; color: inherit; border: 1px solid #2f2c37; border-radius: 12px; padding: 7px 7px 11px; min-width: 0; transition: background .16s, border-color .16s; }
.card-tile:hover { background: #24202a; border-color: #98745b; }
.tile-caption { display: grid; gap: 4px; overflow-wrap: anywhere; font-size: .875rem; line-height: 1.3; }
.tile-caption > span { color: #b7afba; font-size: .8rem; }
.empty { grid-column: 1/-1; text-align: center; padding: 45px 12px; border: 1px dashed var(--border); border-radius: 12px; color: var(--muted); }
.pagination { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 24px; }
.pagination button:disabled { opacity: .45; cursor: default; }
.face { position: relative; aspect-ratio: 360 / 480; width: 100%; container-type: inline-size; isolation: isolate; user-select: none; }
.face-layer { position: absolute; }
img.face-layer { display: block; object-fit: fill; }
img.banner { object-fit: contain; }
.frame { filter: drop-shadow(1cqw 1.2cqw 0 #05050965); }
.ancient-portrait { object-fit: contain !important; }
.ancient-border { mix-blend-mode: screen; opacity: .72; }
.ancient-text { filter: brightness(0); opacity: .66; }
.face-text { display: grid; place-items: center; text-align: center; font-family: CardText, "PingFang SC", sans-serif; color: #fff6e2; line-height: 1.08; font-weight: 400; }
.face-title { font-size: var(--title-size, 7cqw); -webkit-text-stroke: 2.45cqw #4d4b40; paint-order: stroke fill; text-shadow: .5cqw .5cqw .4cqw #0007; white-space: nowrap; }
.face-upgraded .face-title { color: #8fff5e; -webkit-text-stroke-color: #325729; }
.face-type { font-size: 4.15cqw; color: #191818; }
.face-description { font-size: var(--description-size, 5.55cqw); padding-inline: .4cqw; white-space: pre-line; text-shadow: .35cqw .4cqw .2cqw #0006; line-height: 1.18; overflow-wrap: anywhere; }
.inline-resource { white-space: nowrap; }
.inline-resource img { display: inline-block; width: 1.05em; height: 1.05em; object-fit: contain; vertical-align: -.17em; }
.face-energy, .face-stars { paint-order: stroke fill; -webkit-text-stroke: 3.1cqw var(--cost-outline, #214d53); font-size: 8.45cqw; text-shadow: .4cqw .5cqw .3cqw #0006; }
.face-stars { font-size: 5.8cqw; -webkit-text-stroke-width: 2.25cqw; }
.markup-gold { color: #f7d77e; }
.markup-red { color: #f5a091; }
.markup-purple { color: #e2a6fa; }
.markup-green { color: #9fea9b; }
.markup-blue { color: #9bd3ff; }
dialog { color: inherit; background: #1d1b24; border: 1px solid #594451; border-radius: 18px; max-width: min(890px, calc(100% - 26px)); width: 100%; padding: 0; max-height: calc(100dvh - 30px); }
dialog::backdrop { background: #080810c7; backdrop-filter: blur(5px); }
.detail-content { position: relative; display: grid; grid-template-columns: minmax(215px, .82fr) minmax(0, 1fr); gap: 25px; padding: 35px 25px 25px; }
.dialog-close { position: absolute; right: 14px; top: 12px; font-size: .875rem; min-height: 36px; z-index: 1; }
.detail-info { padding-top: 23px; }
.detail-info h2 { font-size: 2.1rem; margin-top: 4px; }
.english { color: var(--muted); margin: 4px 0 16px; }
.attributes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 0; }
.attributes > div { padding: 8px 10px; border-radius: 7px; background: #28242f; }
.attributes dt { color: #bbb1bd; font-size: .8rem; }
.attributes dd { margin: 3px 0 0; overflow-wrap: anywhere; font-size: .9rem; }
.detail-description { white-space: pre-line; line-height: 1.55; margin: 13px 0; }
.detail-actions { display: flex; align-items: center; gap: 10px; }
.detail-actions select { width: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 980px) {
  .filter-head { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .search-label { grid-column: 1/-1; }
  .filter-actions { grid-column: 1/-1; justify-content: end; }
  .shell { width: calc(100% - 32px); }
}
@media (max-width: 540px) {
  .shell { width: calc(100% - 22px); }
  .intro { padding-top: 16px; }
  .total { min-width: 72px; }
  .total strong { font-size: 2rem; }
  .filters { padding: 12px; }
  .filter-head { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .facet { gap: 6px; }
  .chips { gap: 5px; }
  .chip { font-size: .8rem; padding: 5px 7px; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .card-tile { padding-inline: 3px; }
  .results-head { align-items: flex-start; }
  .result-actions { flex-direction: column; align-items: end; gap: 6px; }
  .result-actions select { min-height: 35px; font-size: .8rem; }
  .detail-content { grid-template-columns: 1fr; gap: 0; padding: 44px 14px 18px; }
  .detail-portrait { width: min(68vw, 295px); justify-self: center; }
  .detail-info { padding-top: 0; }
}
