.habitats-page {
  position: relative;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 24px var(--container-gutter) 28px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 20px rgba(45, 65, 56, 0.04);
}

.habitats-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
}

.habitats-header h1 {
  margin-top: 0;
  font-family: var(--font-headline), sans-serif;
  font-size: clamp(28px, 3.5vw, 44px);
  line-height: 1.07;
  letter-spacing: -0.01em;
  color: #3f2f72;
}

.habitats-header p {
  margin-top: 6px;
  color: #63786f;
}

.habitats-toolbar {
  margin-top: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(205, 220, 212, 0.7);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.habitats-toolbar input {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: inset 0 0 0 1px rgba(121, 146, 134, 0.22);
}

.habitats-toolbar input:focus {
  outline: none;
  box-shadow:
    inset 0 0 0 1px rgba(6, 185, 109, 0.4),
    0 0 0 4px rgba(6, 185, 109, 0.12);
}

.habitats-toolbar span {
  color: #5f746b;
  font-size: 14px;
  font-weight: 700;
}

.habitats-grid {
  margin-top: 14px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.habitats-card {
  border-radius: 20px;
  border: 1px solid rgba(198, 216, 207, 0.8);
  background: linear-gradient(148deg, #ffffff 0%, #f6fbf8 100%);
  padding: 11px;
  color: #385349;
}

.habitats-card:hover {
  border-color: rgba(172, 198, 186, 0.92);
  transform: translateY(-1px);
}

.habitats-card-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.habitats-index-no {
  color: #7a8f87;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1;
  font-family: var(--font-headline), sans-serif;
}

.habitats-card h2 {
  margin-top: 8px;
  margin-bottom: 0;
  text-align: center;
  font-size: clamp(24px, 2vw, 33px);
  line-height: 1.1;
  color: #31453f;
  font-family: var(--font-headline), sans-serif;
}

.habitats-subtitle {
  margin-top: 2px;
  text-align: center;
  color: #7d9089;
  font-size: 12px;
}

.habitats-sprite-dock {
  margin-top: 8px;
  display: grid;
  place-items: center;
}

.habitats-sprite {
  width: 82px;
  height: 82px;
  border-radius: 0;
  background: transparent;
  border: 0;
  image-rendering: pixelated;
}

.habitats-sprite.is-empty {
  border-radius: 10px;
  background: #e8f0f6;
  border: 1px solid rgba(194, 209, 224, 0.58);
}

.habitats-panel {
  margin-top: 10px;
  border-radius: 12px;
  background: #f8fbff;
  padding: 8px;
}

.habitats-panel-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.habitats-panel-top h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.1;
  color: #5e7486;
  font-family: var(--font-headline), sans-serif;
}

.habitats-material-row {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.habitats-panel-top-secondary {
  margin-top: 12px;
}

.habitats-panel-fallback {
  color: #7a8f9f;
  font-size: 13px;
}

.habitats-material-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: #edf3f8;
  padding: 4px 8px 4px 4px;
  color: #526779;
  font-size: 12px;
  font-weight: 700;
}

.habitats-material-chip strong {
  color: #f66177;
  font-size: 13px;
}

.habitats-material-sprite {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background-color: #fff;
  border: 1px solid rgba(201, 214, 227, 0.9);
  image-rendering: pixelated;
}

.habitats-material-sprite.is-empty {
  background: #e7eef5;
}

.habitats-material-name {
  line-height: 1;
}

.habitats-pokemon-row {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.habitats-pokemon-dot {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #edf3f8;
  display: grid;
  place-items: center;
}

.habitats-related-sprite {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: transparent;
  image-rendering: pixelated;
}

.habitats-related-fallback {
  font-size: 11px;
  font-weight: 800;
  color: #5c7081;
}

.habitats-empty-list {
  border-radius: 12px;
  background: #f8fbff;
  border: 1px solid rgba(194, 209, 224, 0.58);
  padding: 12px;
  text-align: center;
  color: #738896;
  font-size: 13px;
}

.habitats-pagination {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.habitats-pagination a {
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 0 1px rgba(123, 147, 136, 0.22);
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 700;
}

.habitats-pagination a:hover:not(.is-disabled) {
  transform: translateY(-1px);
  box-shadow:
    inset 0 0 0 1px rgba(6, 185, 109, 0.28),
    0 8px 16px rgba(45, 68, 58, 0.11);
}

.habitats-pagination .is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.habitats-pagination span {
  color: #556b63;
  font-weight: 700;
  font-size: 14px;
}

@media (max-width: 1380px) {
  .habitats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1020px) {
  .habitats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .habitats-page {
    border-radius: 18px;
    padding: 12px 12px 22px;
  }

  .habitats-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .habitats-grid {
    grid-template-columns: 1fr;
  }

  .habitats-card {
    border-radius: 18px;
    padding: 10px;
  }

  .habitats-index-no {
    font-size: 16px;
  }

  .habitats-card h2 {
    margin-top: 6px;
    font-size: 25px;
  }

  .habitats-subtitle {
    font-size: 12px;
  }

  .habitats-sprite {
    width: 74px;
    height: 74px;
    border-radius: 0;
  }

  .habitats-panel {
    border-radius: 10px;
    padding: 7px;
  }

  .habitats-panel-top h3 {
    font-size: 15px;
  }

  .habitats-material-chip {
    font-size: 11px;
    padding: 4px 7px 4px 4px;
    gap: 6px;
  }

  .habitats-material-chip strong {
    font-size: 12px;
  }

  .habitats-material-sprite {
    width: 22px;
    height: 22px;
  }

  .habitats-pokemon-dot {
    width: 32px;
    height: 32px;
  }

  .habitats-related-sprite {
    width: 26px;
    height: 26px;
  }
}
