.monster-gallery { padding-block: clamp(26px, 6vw, 76px) clamp(38px, 7vw, 95px); }
.monster-gallery h1 {
  font-size: clamp(3.6rem, 11vw, 9rem);
  line-height: .9;
  letter-spacing: -.075em;
}
.monster-gallery h1 span { color: var(--accent); }
.gallery-sections { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 24px; }
.gallery-sections a { color: var(--muted); text-decoration: underline; text-underline-offset: .24em; }
.gallery-sections a:hover { color: var(--paper); }
.monster-gallery section { margin-top: clamp(31px, 5vw, 62px); }
.monster-gallery section > h2 {
  padding-bottom: 12px;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--rule);
  font-size: clamp(1.35rem, 2.8vw, 2rem);
  letter-spacing: -.045em;
}
.monster-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(8px, 1.5vw, 18px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.bosses { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bosses img { aspect-ratio: 5 / 4; object-fit: contain; }
.monster-card a {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--rule);
  background: #20271f;
  transition: border-color .2s, background-color .2s;
}
.monster-card a:hover { border-color: var(--accent); background-color: #292d23; }
.monster-card img, .monster-large {
  --light: #626844;
  background: radial-gradient(ellipse at 45% 52%, var(--light), #232c24 70%, #1a221c);
}
[data-habitat="night"] img, .monster-large[data-habitat="night"] { --light: #495570; }
[data-habitat="cave"] img, .monster-large[data-habitat="cave"] { --light: #5a5265; }
[data-habitat="boss"] img, .monster-large[data-habitat="boss"] { --light: #715a41; }
[data-habitat="resident"] img, .monster-large[data-habitat="resident"] { --light: #53696d; }
.monster-card span {
  display: flex;
  align-items: center;
  padding: 9px clamp(7px, 1.15vw, 15px);
  border-top: 1px solid var(--rule);
  font-size: clamp(.9rem, 1.35vw, 1.15rem);
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.monster-card[data-habitat="resident"] span { flex-direction: column; align-items: flex-start; gap: 3px; }
.monster-card span small { color: var(--muted); font-size: .75em; font-weight: 500; }
.monster-viewer {
  width: min(580px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 1px solid var(--rule);
  background: #20271f;
  color: var(--paper);
}
.monster-viewer::backdrop { background: #0c100dd9; }
.monster-viewer header, .monster-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 13px;
}
.monster-viewer h2 { min-width: 0; font-size: clamp(1.2rem, 3.8vw, 1.8rem); overflow-wrap: anywhere; }
.monster-viewer button {
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--rule);
  background: #151a16;
  font-size: 1.4rem;
}
.monster-viewer button:hover { border-color: var(--accent); color: var(--accent); }
.monster-controls { justify-content: center; }
.monster-large img { margin-inline: auto; width: min(100%, calc(100dvh - 168px)); min-width: 140px; }
.monster-gallery .find-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}
.find-card { --location: #b1c589; }
.find-card[data-habitat="mine"] { --location: #d3a68b; }
.find-card[data-habitat="desert"] { --location: #e4bf81; }
.find-card a { border-radius: 10px; overflow: hidden; }
.find-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.find-caption {
  padding: 14px clamp(12px, 2vw, 22px) 19px;
  border-top: 2px solid var(--location);
}
.find-caption h3 {
  margin: 3px 0 8px;
  font-size: clamp(1.25rem, 2.4vw, 1.83rem);
  line-height: 1.05;
  letter-spacing: -.037em;
}
.find-caption p { color: var(--muted); line-height: 1.4; }
.find-caption .find-biome { color: var(--location); font-weight: 650; font-size: .83rem; }
.find-viewer { width: min(1120px, calc(100% - 24px)); }
.find-viewer .monster-large img { width: min(100%, calc((100dvh - 156px) * 16 / 9)); }
@media (max-width: 960px) {
  .monster-grid:not(.bosses, .find-grid) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 960px) and (min-width: 691px) {
  .monster-gallery .find-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 690px) {
  .monster-grid:not(.bosses, .find-grid) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .monster-gallery .find-grid { grid-template-columns: 1fr; gap: 15px; }
}
@media (max-width: 460px) {
  .monster-grid:not(.bosses, .find-grid), .bosses { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bosses .monster-card:first-child { grid-column: 1 / -1; }
  .bosses .monster-card:first-child img { aspect-ratio: 2.25; }
}
