:root {
  --ink: #17201d;
  --forest: #1d3730;
  --forest-deep: #10241f;
  --moss: #627a55;
  --sage: #b7c5a5;
  --paper: #ede9dc;
  --paper-light: #f7f4e9;
  --rust: #a7462f;
  --line: rgba(23, 32, 29, 0.18);
  --display: "ZCOOL XiaoWei", serif;
  --sans: "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

.hero {
  position: relative;
  min-height: 650px;
  overflow: hidden;
  color: var(--paper-light);
  background:
    linear-gradient(115deg, rgba(16, 36, 31, .98) 0 48%, rgba(23, 55, 45, .92)),
    radial-gradient(circle at 80% 25%, #647c5a, transparent 38%);
}
.hero::before, .hero::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(237, 233, 220, .13);
  border-radius: 50%;
}
.hero::before { width: 620px; height: 620px; right: -150px; top: 40px; }
.hero::after { width: 470px; height: 470px; right: -75px; top: 115px; }
.nav {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1220px;
  margin: auto;
  padding: 24px 30px;
  border-bottom: 1px solid rgba(237, 233, 220, .16);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-weight: 700; letter-spacing: .08em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--sage); color: var(--sage); font-size: 12px; }
.source-link { color: var(--paper-light); text-underline-offset: 5px; font-size: 13px; }
.hero-content { position: relative; z-index: 1; max-width: 1220px; margin: auto; padding: 105px 30px 70px; }
.eyebrow { margin: 0 0 20px; color: var(--sage); font-size: 11px; font-weight: 700; letter-spacing: .22em; }
.eyebrow.dark { color: var(--rust); }
.hero h1 { margin: 0; font-family: var(--display); font-size: clamp(84px, 12vw, 154px); font-weight: 400; line-height: .72; letter-spacing: -.03em; }
.hero h1 em { margin-left: .7em; color: var(--sage); font-style: normal; }
.intro { max-width: 490px; margin: 60px 0 36px; color: rgba(247, 244, 233, .74); font-size: 16px; line-height: 1.9; }
.summary { display: flex; gap: 0; }
.summary div { min-width: 130px; padding: 0 30px; border-left: 1px solid rgba(237, 233, 220, .2); }
.summary div:first-child { padding-left: 0; border: 0; }
.summary strong { display: block; font-family: var(--display); font-size: 34px; font-weight: 400; }
.summary span { color: rgba(247, 244, 233, .55); font-size: 11px; letter-spacing: .1em; }
.crest { position: absolute; z-index: 1; right: max(8%, calc((100vw - 1220px) / 2)); top: 175px; display: grid; place-items: center; width: 300px; height: 300px; border: 1px solid rgba(183, 197, 165, .35); border-radius: 50%; color: rgba(183, 197, 165, .2); transform: rotate(-8deg); }
.crest::before { position: absolute; content: ""; inset: 17px; border: 1px dashed rgba(183, 197, 165, .25); border-radius: inherit; }
.crest span { font-family: var(--display); font-size: 150px; }

.catalog { max-width: 1220px; margin: auto; padding: 100px 30px 120px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 40px; }
.section-heading h2, .notice h2 { margin: 0; font-family: var(--display); font-size: clamp(44px, 6vw, 76px); font-weight: 400; }
.result-count { margin: 0 0 8px; color: #68716d; font-size: 13px; }
.filter-panel { display: grid; grid-template-columns: minmax(240px, 2fr) repeat(3, 1fr) auto; align-items: end; gap: 12px; margin-bottom: 35px; padding: 20px; background: rgba(247, 244, 233, .72); border: 1px solid var(--line); }
.filter-panel label > span { display: block; margin-bottom: 7px; color: #68716d; font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.filter-panel input, .filter-panel select { width: 100%; height: 46px; padding: 0 13px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 0; outline: none; }
.filter-panel input:focus, .filter-panel select:focus { border-color: var(--moss); box-shadow: 0 0 0 2px rgba(98, 122, 85, .14); }
.search-field { position: relative; }
.search-field svg { position: absolute; left: 14px; bottom: 14px; width: 18px; fill: none; stroke: var(--moss); stroke-width: 1.8; }
.search-field input { padding-left: 42px; }
.clear-button { height: 46px; padding: 0 18px; color: var(--paper-light); background: var(--forest); border: 1px solid var(--forest); cursor: pointer; }
.clear-button:hover { background: var(--rust); border-color: var(--rust); }

.monster-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.monster-card { min-width: 0; background: var(--paper-light); border: 1px solid var(--line); transition: transform .2s, box-shadow .2s; }
.monster-card:hover { z-index: 1; transform: translateY(-4px); box-shadow: 0 18px 38px rgba(29, 55, 48, .12); }
.card-button { display: block; position: relative; width: 100%; padding: 0; color: inherit; text-align: left; background: none; border: 0; cursor: pointer; }
.card-button:focus-visible { outline: 3px solid var(--rust); outline-offset: 2px; }
.card-index { position: absolute; z-index: 1; top: 18px; left: 18px; color: rgba(247, 244, 233, .65); font-size: 10px; letter-spacing: .12em; }
.silhouette { position: relative; display: grid; place-items: center; height: 160px; overflow: hidden; background: var(--forest); }
.silhouette::before, .silhouette::after { position: absolute; content: ""; width: 140px; height: 140px; border: 1px solid rgba(183, 197, 165, .13); border-radius: 50%; }
.silhouette::after { width: 90px; height: 90px; border-style: dashed; }
.silhouette span { width: 58px; height: 58px; background: var(--sage); opacity: .65; clip-path: polygon(50% 0, 63% 31%, 100% 40%, 70% 60%, 76% 100%, 50% 76%, 24% 100%, 30% 60%, 0 40%, 37% 31%); }
.monster-card:nth-child(3n+2) .silhouette { background: #33483f; }
.monster-card:nth-child(3n) .silhouette { background: #263b36; }
.card-body { padding: 24px; }
.card-meta { min-height: 18px; color: var(--rust); font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.card-body h3 { min-height: 58px; margin: 10px 0 4px; overflow-wrap: anywhere; font-family: var(--display); font-size: 26px; font-weight: 400; line-height: 1.1; }
.taxonomy { margin: 0; color: #6d7571; font-size: 12px; }
.trait-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; margin: 20px 0; }
.trait-list span { padding: 4px 7px; color: var(--forest); background: #e2e6d7; font-size: 9px; }
.detail-link { display: flex; justify-content: space-between; padding-top: 15px; border-top: 1px solid var(--line); color: var(--moss); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.load-more { display: block; min-width: 180px; margin: 40px auto 0; padding: 13px 25px; color: var(--forest); background: transparent; border: 1px solid var(--forest); cursor: pointer; }
.load-more:hover { color: white; background: var(--forest); }
.empty-state { padding: 70px 20px; text-align: center; border: 1px dashed var(--line); }
.empty-state span { font-family: var(--display); font-size: 60px; color: var(--moss); }
.empty-state h3 { margin: 5px; font-family: var(--display); font-size: 28px; font-weight: 400; }
.empty-state p { color: #68716d; }

.notice { padding: 110px max(30px, calc((100vw - 1160px) / 2)); color: var(--paper-light); background: var(--rust); }
.notice .eyebrow { color: #e8c1aa; }
.notice h2 { max-width: 700px; }
.notice > p:last-child { max-width: 660px; margin: 40px 0 0 auto; color: rgba(247, 244, 233, .72); line-height: 2; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 28px max(30px, calc((100vw - 1160px) / 2)); color: rgba(247, 244, 233, .55); background: var(--forest-deep); font-size: 10px; letter-spacing: .1em; }
footer p { margin: 0; }

dialog { width: min(680px, calc(100% - 30px)); max-height: calc(100dvh - 30px); padding: 0; color: var(--ink); background: var(--paper-light); border: 0; box-shadow: 0 30px 80px rgba(8, 20, 16, .45); }
dialog::backdrop { background: rgba(7, 20, 16, .78); backdrop-filter: blur(4px); }
.dialog-close { position: absolute; z-index: 2; top: 14px; right: 17px; width: 38px; height: 38px; color: var(--paper-light); background: rgba(0, 0, 0, .2); border: 1px solid rgba(255, 255, 255, .35); cursor: pointer; font-size: 24px; }
.dialog-header { padding: 55px 55px 40px; color: var(--paper-light); background: var(--forest); }
.dialog-header .eyebrow { margin-bottom: 12px; }
.dialog-header h2 { margin: 0; font-family: var(--display); font-size: clamp(38px, 7vw, 58px); font-weight: 400; line-height: 1.08; }
.dialog-header p { margin: 12px 0 0; color: rgba(247, 244, 233, .65); }
.dialog-body { padding: 38px 55px 50px; }
.detail-section + .detail-section { margin-top: 30px; padding-top: 25px; border-top: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 15px; color: var(--rust); font-size: 10px; letter-spacing: .16em; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.detail-grid div { padding: 13px; background: var(--paper); }
.detail-grid span { display: block; margin-bottom: 5px; color: #777e7a; font-size: 9px; }
.detail-grid strong { font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.ecology-copy, .ecology-empty { margin: 0; color: #59635f; font-size: 12px; line-height: 1.9; }
.ecology-copy + .ecology-copy { margin-top: 12px; }
.ecology-source { margin: 12px 0 0; color: #777e7a; font-size: 10px; letter-spacing: .06em; }
.habitat-list { display: grid; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.habitat-list li { display: grid; grid-template-columns: minmax(110px, 150px) 1fr; gap: 12px; padding: 10px 12px; color: #59635f; background: var(--paper); font-size: 12px; line-height: 1.6; }
.habitat-list span { color: var(--moss); font-size: 10px; font-weight: 700; letter-spacing: .05em; }
.appearance-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.appearance-list li { padding: 8px 10px; border: 1px solid var(--line); font-size: 11px; }
.relations { margin: 0; padding-left: 18px; color: #59635f; font-size: 12px; line-height: 1.9; }

@media (max-width: 900px) {
  .crest { right: -100px; opacity: .45; }
  .filter-panel { grid-template-columns: 2fr 1fr; }
  .clear-button { grid-column: 2; }
  .monster-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .hero { min-height: 610px; }
  .nav { padding: 18px 20px; }
  .source-link { font-size: 11px; }
  .hero-content { padding: 90px 20px 50px; }
  .hero h1 { font-size: 82px; }
  .hero h1 em { margin-left: .4em; }
  .intro { margin-top: 50px; }
  .summary div { min-width: 0; flex: 1; padding: 0 14px; }
  .summary strong { font-size: 28px; }
  .crest { top: 170px; width: 230px; height: 230px; }
  .crest span { font-size: 110px; }
  .catalog { padding: 75px 16px 90px; }
  .section-heading { display: block; }
  .result-count { margin-top: 15px; }
  .filter-panel { grid-template-columns: 1fr 1fr; padding: 14px; }
  .search-field { grid-column: 1 / -1; }
  .filter-panel label:nth-of-type(4) { grid-column: 1 / -1; }
  .clear-button { grid-column: 1 / -1; }
  .monster-grid { grid-template-columns: 1fr; }
  .silhouette { height: 130px; }
  .notice { padding: 80px 22px; }
  footer { display: block; padding: 28px 22px; }
  footer p { margin-top: 10px; line-height: 1.6; }
  .dialog-header { padding: 55px 25px 30px; }
  .dialog-body { padding: 30px 25px 40px; }
  .detail-grid { grid-template-columns: 1fr; }
  .habitat-list li { grid-template-columns: 1fr; gap: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
